Alex Rivera | Logout

Git rebase --continue complains even when all merge conflicts have been resolved

Asked 2011-12-15T16:58:38.207
254

I am using version 1.7.1 of Git. I tried using git rebase master to rebase against master from my branch. I got an error because there was a merge conflict:

First, rewinding head to replay your work on top of it...
Applying: checkstyled.
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging AssetsLoader.java
CONFLICT (content): Merge conflict in AssetsLoader.java
Failed to merge in the changes.
Patch failed at 0001 checkstyled.

After manually editing the file to resolve the conflict, I got this result from git status:

# Not currently on any branch.
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#   modified:   PassengerContactHandler.java
#
# Unmerged paths:
#   (use "git reset HEAD <file>..." to unstage)
#   (use "git add/rm <file>..." as appropriate to mark resolution)
#
#   both modified:      AssetsLoader.java
#

Then, after git add AssetsLoader.java, I tried again, getting:

# Not currently on any branch.
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#   modified:   AssetsLoader.java
#   modified:   PassengerContactHandler.java
#

But then git rebase --continue resulted in:

git rebase --continue
You must edit all merge conflicts and then
mark them as resolved using git add

I know I can skip the patch and continue the rebase; but will the changes in PassengerContactHandler.java will be rebased into my branch? How should I proceed?

Could it be that the file with the resolved conflict is exactly like the original version?

Edit
Report

1 Answer

4

Ive just had this problem, and whilst I think there might be a few causes, here's mine...

I had a git pre-commit hook which rejected commits under certain conditions. This is fine when committing manually, since it will display the output of the hook, and I can either fix it or choose to ignore it using commit --no-verify.

The problem seems to be that when rebasing, rebase --continue will also call the hook (in order to commit the lastest bout of changes). But rebase will not display the hook output, it'll just see that it failed, and then spit out a less specific error saying 'You must edit all merge conflicts and then mark them as resolved using git add'

To fix it, stage all your changes, and instead of doing 'git rebase --continue', try a 'git commit'. If you are suffering from the same hook problem, you should then see the reasons why its failing.

Interestingly, whilst git rebase doesn't display the output from git hook, it does accept a --no-verify to bypass the hooks.

answered 2012-07-17T05:39:10.477

Your Answer