Git rebase --continue complains even when all merge conflicts have been resolved
This happens because when fixing a conflict, you removed all code in the patch beeing applied to the branch you are rebasing on. If you are sure you have added all your changes: Use git rebase --skip
to continue.
A bit more details:
Normally, when fixing a conflict during rebasing, you will edit the conflicting file, keeping some or all of the code in the patch currently being applied to the branch you rebase on. After fixing the patch and doing
git add your/conflicted/file
git status
you will get a (usually green) line showing the modified file
modified: your/conflicted/file
git rebase --continue will work fine in this situation.
Sometimes, however, when resolving the conflict, you remove everything in your new patch, keeping only code from the branch you rebased on. Now when you add the file, it will be exactly like the one you tried to rebase on. git status will show no green line displaying the modified files. Now, if you do
git rebase --continue
git will complain with
No changes - did you forget to use 'git add'?
If you are sure you have added all your changes, what git actually wants you to do in this situation is to use
git rebase --skip
to skip the patch. Previously I never did this, as I was always unsure what would actually be skipped if I did, it was not obvious to me what "skip this patch" really meant. But if you get no green line with
modified: your/conflicted/file
after editing the conflicted file, adding it, and doing git status, then you can be pretty sure you removed the whole patch, and you can instead use
git rebase --skip
to continue.
The original post said this sometimes works:
git add -A git rebase --continue # works magically?
... but don't rely on this (and be sure not to add leftover files in your repository folders)
Seems to be a bug in Git 1.7
Here's a good article on how to solve this.
Basically it should work, if you do a
git diff
after resolving your conflicts and then
git rebase --continue
should work.
I got this warning when I had unstaged files. Make sure you don't have any unstaged files. If you don't want the unstaged files changes, then discard the changes with
git rm <filename>
After fixing the conflict, make sure the changed files(s) are added to your staged files. This solved the problem for me.