Forgot “git rebase –continue” and did “git commit”. How to fix?


I was rebasing code in git, I got some merge conflicts. I resolved the conflicts and did:

At this point I forgot to do:

I continued coding and did:

for the changes. Now I am on "no branch" and can’t do:

How do I fix this?


EDIT: Look at the answer below as well to see if that’s an easier solution for you.

I’d have to try it out, but I think this is what I would do:

  1. Tag your latest commit (or just write down its SHA1 somewhere so you don’t lose it): git tag temp
  2. git rebase --abort
  3. Do the rebase again. You’ll have to resolve the merge again. 🙁
  4. git rebase --continue
  5. git cherry-pick temp

The problem with this is that your temp commit probably contains both the resolution of the merge, and the new code. So it could be tricky but I would try it and see if it works.

Leave a Reply