I'm using git rebase -i to rewrite history — in this case, make a small alteration to an earlier commit's change set. In other words,
A---B---C master
--->
A---B'--C master
I know C is implicitly changing, too, but you get the idea. Here's my progress so far:
git rebase -i HEAD~2B from keep to edit.git commit -a --amendgit rebase --continueI've resolved the conflicted lines in C, but am unsure how to mark it as resolved so that the rebase can continue. git commit --amend attempts to amend B, while git rebase --continue complains that the working tree is dirty. (And, sure enough, git status shows the file as "both modified".)
What do I need to do to get this rebase back on track?
When you run into the 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 that's exactly what you need to do:
# resolve the conflicts somehow
git add <conflicted-file>
git rebase --continue
Don't try to use commit --amend. HEAD (the current commit) still refers to the one just before, since the conflicts have prevented this commit from being made, so as you saw, that just amends the already-applied commit. rebase --continue will proceed to make the new commit containing the resolved conflicts.
Have you tried doing it explicitly, i.e.: git add B', then committing it with --amend, then doing git rebase --continue?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With