git ours & git theirs

Easy merging when you know which files you want

Git alias:

ours   = !"f() { git checkout --ours   $@ && git add $@; }; f"
theirs = !"f() { git checkout --theirs $@ && git add $@; }; f"

Example:

git ours
git theirs

Sometimes during a merge you want to take a file from one side wholesale.

The following aliases expose the “ours” and “theirs” options which let you pick a file(s) from the current branch or the merged branch respectively.

Compare: