Home > OS >  How undo a git rebase --abort?
How undo a git rebase --abort?

Time:02-22

I was performing a git rebase before working on my changes. Unfortunately I didnt finish the rebase and without realising rebase was in progress I started working on my changes. Later when I was building I realised rebase was in progress causing a bunch of conflicts so i did git rebase --abort and lost my working changes as well. Anything I can do to get that back?

CodePudding user response:

Anything I can do to get that back?

No. The unit of preservation in Git is the commit. Anything not committed is transient.

CodePudding user response:

First of all, be sure you commit/stash/somehow preserve current work progress to not lose anything again.

You shoud be able to get to the last successfull rebased commits from the reflog:

git reflog

Apply some research and get the hash of the last commit of a rebase operation you are/were satisfied with and rebase to that point with interactive mode:

git rebase -i that-hash

Then choose wisely the commits left to rebase and you should be ok.

  • Related