Sunday, March 29, 2015

Git merge conflict using git mergetool




When you pull changes from the Git server you might get conflict in your code.
sudo git fetch origin
sudo  git merge origin/master

 So we will see how to resolve those conflicts. You can use git mergetool to check the conflicts. This is the merge conflict resolution tools to resolve merge conflicts.

 git mergetool

  1. git checkout --ours <your File name>   
  2. git checkout --theirs <your File name>   
  3. git add <your File name>   
  4. git commit -m "Conflicts Resolve"  
sudo git pull origin/master
(here remote is origin, local is master)
Note Difference between pull and fetch
n the simplest terms, git pull does a git fetch followed by a git merge.

No comments:

Post a Comment