Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git reset current rebase

Tags:

git

rebase

I've been doing a rebase. I've worked on fixing some conflicts but I've ended up going in the wrong direction and now I just want to start again fixing these conflicts.

I'd like to reset the rebase, so that I'm still rebasing the current commit but the working copy has been reset to when the commit was flagged up with conflicts in the first place.

How can I reset a rebase on the current commit?

like image 322
Puppy Avatar asked Feb 03 '16 09:02

Puppy


2 Answers

If you are in between your rebase, you can do

git rebase --abort
like image 198
Ravi Shrivastava Avatar answered Sep 20 '22 13:09

Ravi Shrivastava


First, clear the mess:

git reset --hard HEAD

Then, cherry-pick the commit you are currently rebasing:

git cherry-pick -n `git rev-parse REBASE_HEAD`

That's it. As usual, you will be able to continue the rebase after fixing conflicts.

like image 38
Pierre-Luc Carmel Biron Avatar answered Sep 18 '22 13:09

Pierre-Luc Carmel Biron