0

I'm doing a rebase of master on my branch. There is binary file that conflicts (i expected a conflict) and i just want to accept the one on the branch. If this was a text file i would just open the file with the mergetool and accept everything on my brach but since its binary i can't do that of course. So say the branch name is branch1 and after doing a rebase:

 K:\gitrepo\supplemental [(1c58d85...)|REBASE +0 ~0 -0 !1 | +0 ~0 -0 !1]> g s
# Not currently on any branch.
# You are currently rebasing.
#   (fix conflicts and then run "git rebase --continue")
#   (use "git rebase --skip" to skip this patch)
#   (use "git rebase --abort" to check out the original branch)
#
# Unmerged paths:
#   (use "git reset HEAD <file>..." to unstage)
#   (use "git add <file>..." to mark resolution)
#
#       both modified:      mybinaryfiles/file.bin
#

To accept the file on the branch and finish the rebase would i just:

git add .
git rebase --continue

To make the question more complete what would i do if i wanted to accept the file from master rather than the branch?

In trying to understand what git actually does during a merge conflict in a rebase....does it actually keep the conflicted file intact and just wants you to confirm that this is correct by doing a git add

coding4fun
  • 8,038
  • 13
  • 58
  • 85

2 Answers2

2

Git merge supports different merge strategies including ours and theirs. Git rebase allows to use this merge strategies by using -m option. I suggest reading git-merge and git-rebase manual before you start playing, because there are some quirks about it.

See also:

  1. How do I select a merge strategy for a git rebase?

  2. How could I use a different strategy for just one commit in a rebase?

Community
  • 1
  • 1
Adrian
  • 1,166
  • 6
  • 15
2

You have both (well, all three including the base version) available in the index. You can retrieve the 'master' version or the 'being-rebased' branch version with:

git checkout --ours mybinaryfiles/file.bin

and

git checkout --theirs mybinaryfiles/file.bin

respectively.

Then just git add mybinaryfiles/file.bin and git commit.

CB Bailey
  • 755,051
  • 104
  • 632
  • 656
  • Thanks that is exactly what i needed. For some reason after i did a rebase --continue i had to do a rebase --skip also but it all seems to have worked out – coding4fun Apr 19 '13 at 17:21