Skip to content

Instantly share code, notes, and snippets.

@canton7
Last active August 16, 2024 08:21
Show Gist options
  • Save canton7/1268587 to your computer and use it in GitHub Desktop.
Save canton7/1268587 to your computer and use it in GitHub Desktop.
git merge -s theirs

How to do a git merge -s theirs

One way of many...

This is one way which keeps the history looking like you'd expect.

Command is equivalent to git checkout MINE; git merge -s theirs HERS.

git checkout MINE
git merge --no-commit -s ours HERS
git rm -rf .
git checkout HERS -- .
git commit

From http://www.seanius.net/blog/2011/02/git-merge-s-theirs/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment