Skip to content

Latest commit

 

History

History

git-ours-git-theirs

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

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:

  • git ours - Checkout our version of a file and add it

  • git theirs - Checkout their version of a file and add it