Git 2.17 Clarifies Moved Code
Git 2.17 Clarifies Moved Code
Written by Kay Ewbank   
Monday, 09 April 2018

Git 2.17 has been released with support for coloring moved code, and new hooks to speed up status.

Git is the most popular version control system. Originally developed as a bunch of scripts to maintain the development of the linux kernel, it is fast, compresses well and has a lot of tools and resources that work with and around it.

The improvements to moving code overcome the problem where you're looking at a commit that moved some code. Traditionally, this shows as the lines that were moved being deleted in the original location, and inserted at the new location. This will appear as being simple code movement. The new option gives you a clearer view of what happened and whether any lines needed to be changed.The --color-moved option colors groups of moved lines differently. The colors used are user definable, but you can have one color for lines that were moved without being changed, and another color for lines that were moved and changed. By default, old and new blocks get their own colors, and non-adjacent groups of lines are colored independently.




The second improvement reduces the time taken to check the status of files. Git status uses the system stats to see whether each file’s size or timestamp has changed since the last time Git checked. If not, it assumes that its contents haven’t changed. However, while this is faster than reading all the files, it still means git has to call stat() once for every file in your working copy, which can take time if you have a lot of files. Git now has a new fsmonitor hook that relies on the operating system to say what has changed. The hook provides a generic interface into which you can plug any tool, but given the popularity of the watchman tool, Git ships with a sample hook for using watchman.

Another improvement is the addition of a find object command. This provides a way to work out where an object appeared in the history in terms of commits and paths, letting you select the commits you want and display them however you like.

The final improvement of note is a change to the way grep works function context. This change improves the way grep works so that when you use grep with the --function-context option, which shows the whole function surrounding a match, it also shows any comments before the start of a function.



More Information

Git On GitHub

Related Articles

GitHub Introduces Embedded Code Snippets

Git 2.5 Released 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on, Twitter, FacebookGoogle+ or Linkedin.


Android Studio 3.1 Released - Widgets Lost

Android Studio 3.1 is a minor upgrade but it still has the power to cause problems for its users. In this case why have familiar pickers and other widgets disappeared?

GitHub Learning Labs Now Open For Newbies

Once you know your way around GitHub its difficult to remember how it felt when it was an unfamiliar environment with its strange jargon of Commits, Issues, Pull Requests and so on. The newly launched [ ... ]

More News



or email your comment to:

Last Updated ( Monday, 09 April 2018 )

RSS feed of news items only
I Programmer News
Copyright © 2018 All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.