Home

Advertisement

July 16th, 2008


Previous Entry Add to Memories Tell a Friend Next Entry
11:00 pm - Innovations in git
There are a few things in git that I haven't seen in other SCMs before I got working with git. Some are probably because I haven't studied existing systems, but some are quite cool inventions that happened in our project, and I have grown to be quite fond of them:
  • merge-recursive is an invention of Fredrik Kuivinen.  When you have a criss-cross merge topology, the result of 3-way merge becomes ambiguous depending on which common ancestor you pick to use.  Idea invented by Fredrik to overcome this issue was to come up with an extra merge between common ancestors first, and use the result of this merge as a virtual common ancestor (hence the name recursive).  Even when this inner merge results in conflicted contents, the end result tends to cancel out in practice, which is quite a nice hack.
     
  • rerere is my invention, although it owes some inspiration to merge-recursive.  When you need to perform the same merge repeatedly, this mechanism records how conflicted merge looked like before your manual fix-up, and how you fixed it up, and it uses that result when you are doing the same merge next time.

    Now, people might wonder why somebody may want to do the same merge more than once, but it actually happens very often in real life.  When you use many topic branches in your workflow, you will merge some of them to test them out together, and they may have conflicting interactions.  You test them out for a while, you discard the merge result after trial (perhaps because you found some parts of the topics merged were not good enough for publishing), and go back to individial topics to improve things.  Then you repeat the whole process, adding further improvements to topics, performing trial merge of them, and testing them out, until one or some of them take satisfactory shape and then finally merge them to the mainline for publishing. Once you get used to this workflow, you will find yourself resolving the same conflicts between the same topic branches over and over.
     
  • rename/copy detecting diff was co-invented by Linus and me.
     
  • grep that allows you to "and" the match criteria together, and also pick a file (not a line) that matches all the criteria given was a good addition I made (I've written about it in other entries here).  It is quite useful when grepping inside the commit messages, and encourages people to write a good ones.
  • combined diff is my invention.  When reviewing a merge commit, it is not very interesting to view the differences between the state before the merge and after the merge -- most often in a straightforward merge, such a diff will just show all the changes that happened in the merged branch as a single large change without any logical boundary and does not give much to work on for people who are inspecting the changes. Instead, combined diff gives only the parts that the result is different from any of the merged branches --- that typically shows non-trivial merge conflict resolution done by the person who made the merge.
     
  • blame that follows block-of-line movement was invented by Linus as a vision long time ago but it took very long time to materialize.
 
Tags:

(Leave a comment)

gitster's journal - Innovations in git

> Recent Entries
> Archive
> Friends
> User Info

Links
Pages at the k.org
Gifts
貢ぎ物

> Go to Top
LiveJournal.com

Advertisement