My situation: There are two remotes, origin
and fork
(the latter is owned by me). I checked out origin/devel
, changed some code and committed like 5x to my local branch test
. I pushed my commits to fork/test
.
Then I started an interactive rebase, while on my local test
branch:
git rebase -i --onto origin/devel
Git opened an editor with a list of my 5 commits, ready to pick, squash or whatever.
I accidentally closed the editor instead of deleting everything or Ctrl+C and git rebase --abort
in git console. Thus, it started the rebase.
In order to undo it, I used git reflog
and git reset --hard HEAD@{...}
and also git checkout fork/test -B test
later, since my remote should also contain the pre-rebase state. All of them seem to recover the state, but if I start the rebase again, there will be no commit in list (only a noop
entry).
How do I recover the original state before the rebasing, so that the original commit list is shown again?
Undoing a git rebase does not cover this issue. I'm mainly interested in why this happens and how to really revert the rebase, not how to alter the rebase
command to get the commit list again (as I said, git reset
and git checkout
did NOT undo it properly from my point of view).
The ultimate goal is to rebase my test
branch onto the up-to-date origin/devel
at some later point, squashing all my own commits since test
diverged from origin/devel
.
//edit: It looks as though Git forgot the fork-point. git merge-base --fork-point origin/devel
does return the origin/devel
commit before my own commits however, and git rebase -i that-commit
gives me the initial commit list. So why does --onto
not do the same anymore?