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

sanmai picture sanmai · May 22, 2012 · Viewed 896.1k times · Source

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.

Answer

Pascal Fares picture Pascal Fares · Feb 14, 2014
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