1

I've made a pull with rebase:

git pull --rebase

After two commits were successfully applied I started applying the third one. It the middle of this I realized that I did it wrong and it would be good to undo it. Of course I can do git

rebase --abort

but then I'll loose all the work I've done (two applied commits).

Is there any way to undo the process of applying current commit during rebase and start merging again?

Ivan Mushketyk
  • 8,107
  • 7
  • 50
  • 67

1 Answers1

1

You can do a

git rebase --skip

(perhaps multiple times)

That way, your applied commits will be saved. However at that point your third commit will be hidden, so follow up with:

git branch old-commit ORIG_HEAD

to have access to your other (third an following) commits.

For finishing touch, you could do

git checkout old-commit && git rebase --interactive HEAD...master

and remove the successfully rebased commits.

blackbuild
  • 5,026
  • 1
  • 23
  • 35
  • And after that I should do "git pull --rebase" again. Right? – Ivan Mushketyk Mar 21 '14 at 16:35
  • To rebase the rest of your commits, yes (if you want to continue right away, you could skip the rebase interactive, since the next pull would throw away your already rebased commits) – blackbuild Mar 21 '14 at 16:40