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.
The 'ours' in Git is referring to the original working branch which has authoritative/canonical part of git history. The 'theirs' refers to the version that holds the work in order to be rebased (changes to be replayed onto the current branch).
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With