How to continue merging after a double change?

I use git rebase -i to overwrite history - in this case, make a small change for an earlier set of commit changes. In other words,

 A---B---C master ---> A---B'--C master 

I know that C also changes implicitly, but you get the idea. Here is my progress:

  • git rebase -i HEAD~2
  • Change B from keep to edit .
  • Edit the file.
  • git commit -a --amend
  • git rebase --continue
  • "Unable to apply [C] ..."

I resolved conflicting strings in C , but I'm not sure how to mark it as resolved in order to continue recovery. git commit --amend tries to change B , and git rebase --continue complains that the working tree is dirty. (And, of course, git status shows the file as “both modified”.)

What do I need to do to get this back?

+8
git rebase conflict
source share
2 answers

When you encounter conflicts, you should see a message something like this:

 error: could not apply 45cb26a... <commit message subject> hint: after resolving the conflicts, mark the corrected paths hint: with 'git add <paths>' and run 'git rebase --continue' 

And this is exactly what you need to do:

 # resolve the conflicts somehow git add <conflicted-file> git rebase --continue 

Do not try to use commit --amend . HEAD (current commit) is still the same as it was before, because conflicts prevented this commit from doing as you saw, which only compensates for the commit already applied. rebase --continue will continue to execute a new commit containing resolved conflicts.

+10
source share

Have you tried to do this explicitly, i.e.: git add B' , then doing it with --amend , then doing git rebase --continue ?

+1
source share

All Articles