Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resolve Git merge conflicts in favor of their changes during a pull

How do I resolve a git merge conflict in favor of pulled changes ?

Basically I need to remove all conflicting changes from a working tree without having to go through all of the conflicts with a git mergetool while keeping all conflict-free changes. Preferably doing this while pulling, not afterwards.

like image 671
sanmai Avatar asked May 22 '12 07:05

sanmai


People also ask

Can Git resolve merge conflicts?

Git commands that can help resolve merge conflicts The status command is in frequent use when a working with Git and during a merge it will help identify conflicted files. Passing the --merge argument to the git log command will produce a log with a list of commits that conflict between the merging branches.


1 Answers

git pull -s recursive -X theirs <remoterepo or other repo> 

Or, simply, for the default repository:

git pull -X theirs 

If you're already in conflicted state...

git checkout --theirs path/to/file 
like image 82
Pascal Fares Avatar answered Sep 19 '22 12:09

Pascal Fares