Thursday 21 June 2018

git merge

Today i learned i deep about merging in Git.

git merge [-n] [--stat] [--no-commit] [--squash] [--[no-]edit]
 [-s <strategy>] [-X <strategy-option>] [-S[<keyid>]]
 [--[no-]allow-unrelated-histories]
 [--[no-]rerere-autoupdate] [-m <msg>] [<commit>…​]
git merge --abort
git merge --continue
git merge   

 * Consider that we changes to topic branch and its diverged from E and mades changes till C.
Now we would like to merge it with master in which the commit head is at G.
          A---B---C topic
  /
    D---E---F---G master  
    

* git merge topic will try to merge the changes to master with new commit. 
     
          A---B---C topic
  /         \
    D---E---F---G---H master

git merge --abort

 can only be run after the merge has resulted in conflicts. git merge --abort will abort the merge process and try to reconstruct the pre-merge state

git merge --continue

   can only be run after the merge has resulted in conflicts.



No comments:

Post a Comment