is there anyway to revert and recover a git rebase
operation after --abort
ing it?
I did a git rebase --abort
after the following rebase output:
On branch feature/cool-feature-x
Last commands done (20 commands done):
pick bd4c3q commitA
pick e53wr1 commitB
(see more in file .git/rebase-merge/done)
Next commands to do (7 remaining commands):
pick ws5b4 update
(use "git rebase --edit-todo" to view and edit)
You are currently editing a commit while rebasing branch 'feature/cool-feature-x' on 'as34y5'.
(use "git commit --amend" to amend the current commit)
(use "git rebase --continue" once you are satisfied with your changes)
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
git log:
gives me an older commit as expected. Say the last commit i.e last-working-commit
git reflog
has all the history as expected. I want to use HEAD{2}
git reset --hard HEAD{2}
to the last change I did gives me this:
warning: Log for ref HEAD unexpectedly ended on Sun, 5 Jun 2018 16:15:19
+0300 (last time I made the changes before `git rebase --abort`)
However last-working-commit
is still the same. and every time I run the same command, i get multiple last-working-commit
in log
reference Questions: Undoing a git rebase
Git: how to undo merge during rebase
EDIT:
git reset
seemed to have worked even after the warning. it was creating the same last commit every time but after switching back to the branch i originally did rebase
on, HEAD was actually reset as I wanted. I don't know why it behaved this way, and there was that warning.