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

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


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


You can use the recursive "theirs" strategy option:

git merge --strategy-option theirs

From the man:

ours    This option forces conflicting hunks to be auto-resolved cleanly by     favoring our version. Changes from the other tree that do not     conflict with our side are reflected to the merge result.    This should not be confused with the ours merge strategy, which does     not even look at what the other tree contains at all. It discards     everything the other tree did, declaring our history contains all that    happened in it.theirs    This is opposite of ours.

Note: as the man page says, the "ours" merge strategy-option is very different from the "ours" merge strategy.


If you're already in conflicted state, and you want to just accept all of theirs:

git checkout --theirs .git add .

If you want to do the opposite:

git checkout --ours .git add .

This is pretty drastic, so make sure you really want to wipe everything out like this before doing it.