How to Merge in GIT

  • register modified and untracked files
git add <files-to-add> 
  • Commit changes
git commit -m “commit message”
  • pull changes from origin
git pull --rebase
  • In case, merge conflict appears
git mergetool --tool=opendiff
  • Once merge is complete, save file and complete rebasing
git rebase --continue
  • Push finally
git push

resolve behind revisions

  • Checkout to local-branch
git checkout <local-branch>
E.g.
git checkout master
  • See if it has now ahead/behind revisions differences status
git branch -vv
  • Resolve behind revisions
    • Fetch all to update remote-branch in local cache
   git fetch --all 
    • Merge now remote branch to local branch (fast-forward)
   git merge <remote-branch>
   E.g.
   git merge origin/master
  • pull changes from origin
git pull --rebase
  • In case, merge conflict appears
git mergetool --tool=opendiff
  • Once merge is complete, save file and complete rebasing
git rebase --continue
  • Push finally
git push

* The Content stated above is for informational purpose only. Expert Software Team is not responsible if any part of content found meaningless in any manner or condition.

Leave a Reply

Your email address will not be published. Required fields are marked *