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, Facebook or Linkedin.

Banner


Apache Updates Wicket
03/10/2024

Apache Wicket has been updated to version 10.2, following the major release of Wicket 10 earlier this year. The open source Java web framework is now built on top of Java 17, and has a new module test [ ... ]



Microsoft Open Sources Drasi
18/10/2024

Microsoft has announced the open source availability of Drasi, a data processing system designed to simplify the detection of and reaction to critical events within complex event-driven infrastructure [ ... ]


More News

espbook

 

Comments




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

Last Updated ( Monday, 09 April 2018 )