Resolve conflicts for binary files (Git)

There are common scenarios where you possibly have to resolve conflicts. They are cherry-pick, merge, rebase and revert. If those conflicts are found in binary files it makes no sence to use a mergetool.

Instead use the following git command:

$ git checkout --[ours|theirs] -- path/to/bin_file

Sounds easy, but you sometimes have to think twice if you want in that scenario ‘ours’ or ‘theirs’.

As a general hint:
– ‘ours’ is where the changes are happening
– ‘theirs’ is the foundation for the changes


Cherry-pick / Merge

- ours   ... the branch where you cherry-pick / merge into
- theirs ... the branch where you cherry-pick / merge from

Rebase

- ours   ... the branch which gets rebased onto another base
- theirs ... the branch which acts as the base for the rebase

Revert

- ours   ... the state on the currently newest commit
- theirs ... the state before the commit to be reverted