Reputation: 103717
With git, how do I do a "use theirs" type branch merge command? This command should just overwrite my local version with the origin's version.
Upvotes: 12
Views: 4573
Reputation: 139711
To replace your master with origin's master:
$ git checkout master
$ git branch -M master old-master
$ git checkout --track -b master origin/master
The git-merge
manpage defines the 'ours' strategy as (emphasis added)
MERGE STRATEGIES
ours This resolves any number of heads, but the result of the merge is always the current branch head. It is meant to be used to supersede old development history of side branches.
If you want a remote branch to win, create a tracking branch, check it out, and git merge -s ours ...
from there.
Upvotes: 5