19 Jan 2017

Understanding a merge commit - git

This is what I sent today to my colleagues while explaining the reason for mysterious changes in a pull-request
That blank merge commit is the culprit. All changes which should be result of merge are blown away.
Explanation:-
First let's understand that a merge commit is also a commit with changes. Changes in source branch since its diversion (from destination branch) are auto-magically done as part of merge commit in destination branch. 
So a merge occurred without any changes (if its been blown away as it has been the case) in merge commit, is basically a reversal of all changes that have occurred in source branch since the destination branch diverged from it. Hope this clarifies the mystery.
To visualise how chain of commits are formed, diverged and merged, you can refer to the image in Understanding what GIT does under the hood rather than only learning commands and wondering

2 comments:

  1. Thanks for sharing the article, its really useful. Keep updating more with us.

    ReplyDelete
  2. Expert Web Solutions a top leading website designing company in tilak nagar, delhi. we are providing cheapest web designing service company in delhi and all over india. Website designing company in janakpuri. VIEW MORE :- Website designing company Delhi

    ReplyDelete