« Back to Index

git: –theirs and –ours

View original Gist on GitHub

Tags: #git #rebase #merge

git rebase theirs and ours.md

https://nitaym.github.io/ourstheirs/

The summary is: git checkout has the following flags whose assigned values can be very confusing.

The flag values don’t change between git merge and git rebase (e.g. †) so it’s safe to remember the above values.

git switch main && git merge feature vs git switch feature && git rebase main.

Rebase Example

I typically rebase feature over my main branch:

git switch feature
git pull --rebase origin main
git checkout --theirs <file>
git add <file>
git rebase --continue