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.

 

gitcolormoved

 

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.

gitlogo
 

 

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.

Banner


The 2018 Hour of Code Season Revs Up
02/11/2018

A brand new Minecraft activity from Code.org and Microsoft heads the bill for the sixth iteration of the Hour of Code - which  runs from December 3-9, 2018. There are already over 40 thousan [ ... ]



TypeScript 3.1 Adds Mappable Tuples
25/10/2018

TypeScript has been updated to add support for mappable tuple and array types.


More News

Python

 



 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Monday, 09 April 2018 )