Friday, January 13, 2012

You gotta love git's merge capabilities

One often cited advantage to using git over svn is that merges are better supported. In my experience, that argument is valid. For example, I just merged upstream changes into my repository. One local change I had checked in was a change in the visibility of one class - it had to go from package private to public. My colleague had the exact same change already committed. A miscommunication that would have resulted in a merge conflict, using svn. Git just told me that the patch was already applied and went on:

Applying: class has to be public
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
No changes -- Patch already applied.

Not only did I not have to resolve a conflict, but my now unecessary commit is just optimized away, which helps to keep history clean and understandable.

In addition to this I'm using git svn to interact with the company repo. So, even when svn is the backend, using git as an interface helps to avoid unecessary merge conflicts. I very much appreciate that in my daily work.

No comments:

Post a Comment