git - How do I merge a binary file? -
i have binary file in my_branch, , when need make changes it, git of course not merge it.
so is:
git checkout my_branch # make change gui.bin mv gui.bin ~/ git commit -a mv ~/gui.bin . git commit -a # git rebase 1 commit git checkout master git merge my_branch
but there easier way?
i'm not quite sure test case driving at. seem moving gui.bin out of way , putting way was...
often, binary files don't need merged, want chose definitive version 1 place or another. genuinely have merged either need custom merge tool, or use sort of editor , lots of manual intervention.
i notice use commit -a
in example. 1 first step avoid unnecessary conflicts not commit binaries might touched incidentally unless want commit them. if git add
files need commit , commit without -a
help. alternatively, if there 1 file don't want commit add -u
, reset before making commit.
git add -u git reset -- dontcommit.dat git commit
when merge branches have both change binary may want keep 1 version , not other. after merge git tells conflicts in binary can tell git use version in branch on this:
git checkout --ours binary.dat git add binary.dat
or branch merging in this:
git checkout --theirs binary.dat git add binary.dat
Comments
Post a Comment