Git rebase merge conflict cannot continue

GitGit Rebase

Git Problem Overview


I'm trying to rebase 'dev' to catch up to 'master' branch.

$ git checkout dev 
$ git rebase master 
First, rewinding head to replay your work on top of it...
Applying: Corrected compilation problems that came from conversion from SVN.
Using index info to reconstruct a base tree...
M       src/com/....
<stdin>:125: trailing whitespace.
/**
<stdin>:126: trailing whitespace.
 *
<stdin>:127: trailing whitespace.
 */
<stdin>:128: trailing whitespace.
package com....
<stdin>:129: trailing whitespace.

warning: squelched 117 whitespace errors
warning: 122 lines add whitespace errors.
Falling back to patching base and 3-way merge...
Auto-merging src/com/....
CONFLICT (content): Merge conflict in src/com/...
Failed to merge in the changes.
Patch failed at 0001 Corrected compilation problems that came from conversion from SVN.

When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To check out the original branch and stop rebasing run "git rebase --abort".

$ vi src/com/.....   { fixed the merge issue on one file } 
$ git add -A . 
$ git rebase --continue 
src/com/....: needs merge
You must edit all merge conflicts and then
mark them as resolved using git add
$ vi src/com....      { verified, no >>> or <<< left, no merge markers } 
$ git rebase --continue 
Applying: Corrected compilation problems that came from conversion from SVN.
No changes - did you forget to use 'git add'?
If there is nothing left to stage, chances are that something else
already introduced the same changes; you might want to skip this patch.

When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To check out the original branch and stop rebasing run "git rebase --abort".

Any ideas?

Git Solutions


Solution 1 - Git

There are a couple situations where I've seen rebase get stuck. One is if the changes become null (a commit has changes that were already made previously in the rebase) in which case you may have to use git rebase --skip.

It's pretty easy to tell. If you do git status it should show no changes. If so just skip it. If that isn't the case please post a copy of git status and I can try to help further.

Solution 2 - Git

One of the times that I have run into this issue is when doing a git commit after a git add. So, the following sequence will produce the rebase error you mention:

git add <file with conflict>
git commit -m "<some message>"  
git rebase --continue

While, the sequence below runs without any errors, and continues the rebase:

git add <file with conflict>
git rebase --continue

It might be possible that git add -A with the "All" option is creating a similar situation. (Please note, I am very inexperienced in git, so this answer may not be correct.) To be safe, the git rebase --skip seems to also work well in this situation.

Solution 3 - Git

Note: Git 2.0.2 (July 2014) has fixed one case where a git rebase --skip would get stuck and wouldn't be able to go on with the current rebase.
See commit 95104c7 by brian m. carlson (bk2204)

rebase--merge: fix --skip with two conflicts in a row

> If git rebase --merge encountered a conflict, --skip would not work if the next commit also conflicted.
The msgnum file would never be updated with the new patch number, so no patch would actually be skipped, resulting in an inescapable loop.

> Update the msgnum file's value as the first thing in call_merge.
This also avoids an "Already applied" message when skipping a commit.
There is no visible change for the other contexts in which call_merge is invoked, as the msgnum file's value remains unchanged in those situations.

Solution 4 - Git

$ vi src/com....      { verified, no >>> or <<< left, no merge markers } 
$ git rebase --continue 

Looks like you forgot to git add your changes...

Solution 5 - Git

After a rebase with lots of conflicts (long git status) I couldn't figure out what it was that I was supposed to stage. I use Git integrated with PhpStorm and it didn't show any unstaged files.

git add . didn't solve it but this comment recommended calling git diff-files --ignore-submodules. That showed three files I had to specifically git add and that did the trick.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionawmView Question on Stackoverflow
Solution 1 - GitChris NicolaView Answer on Stackoverflow
Solution 2 - GitSteve ReedView Answer on Stackoverflow
Solution 3 - GitVonCView Answer on Stackoverflow
Solution 4 - GitJohn BrodieView Answer on Stackoverflow
Solution 5 - GitPetr 'PePa' PavelView Answer on Stackoverflow