Ms. Corlib
Ms. Corlib

Reputation: 5213

Possible to go back to the state I was in before running 'git rebase --abort'

Long-story-short, I was in the middle of developing on a branch and didn't know that I was in the middle of a rebase. When I was done developing on the branch and saw REBASE 1/1 and then ran git rebase --abort and now I seem to have lost all my changes. Is there any way I can essentially undo that last action?

Upvotes: 0

Views: 602

Answers (2)

Sam Varshavchik
Sam Varshavchik

Reputation: 118340

If you have committed your changes, before running git rebase --abort, you can find those commits with git reflog.

Uncommitted changes at the time of git rebase --abort are irrevocably lost.

Upvotes: 1

David Neiss
David Neiss

Reputation: 8237

Look at your reflog, git reflog. You can get back to where you were before you started the rebase if somehow you wind up on some other commit. You haven't lost everything, don't panic. Once you find where you want to get back to in the reflog, do a git reset --hard HEAD@{xx} and find the XX number in the reflog. Note this this will overwrite things in your current dir, so just in case you have changes you want, you should stash them, but your active branch should now point to that commit where you wanted to be at and your working dir & index should be consistent with that commit.

Upvotes: 1

Related Questions