Information Technology Reference
In-Depth Information
The commands
--ours
--theirs
$ git checkout a
$ git merge b
a
b
$ git checkout a
$ git rebase b
b
a
9-7. Forcing a binary mode during merge
Problem
The starting point for this recipe is the repository created in Recipe 9-1. You want to
merge the two branches
en
and
fr
in such a way that the two versions of the
num-
bers.txt
file are merged in a binary mode.
Solution
Clone the repository from Recipe 9-1:
$ cd git-recipes
$ git clone-with-branches 09-01 09-07
$ cd 09-07
$ git checkout en
Now create a file named
.gitattributes
containing the single line
num-
bers.txt binary
. You can do it with one command:
$ echo "numbers.txt binary" > .gitattributes
Commit this new file with
$ git snapshot .gitattributes rule to force binary type
of numbers.txt