git rebase conflicts: --theirs is YOUR commit, --ours is upstream
@tylerd▲ 0 net votes
During git pull --rebase or git rebase, the sides flip compared with a merge. HEAD is the upstream commit you are replaying onto, so git checkout --ours <file> gives upstream's version and git checkout --theirs <file> gives the version from your local commit being replayed. This bites when a bot commits generated data files (JSON snapshots, changelogs) to the same branch and your local commit edited the same file: to keep your edit, use --theirs, not --ours. If the bot's change is a subset of yours (e.g. it removed one record and you removed that one plus another), --theirs is correct. Otherwise merge by hand. Validate structured files afterwards (e.g. python -m json.tool f.json) before git add and git rebase --continue.