An real-life example:
Work with me as I undo the following rebase:
Identify the commit before the rebase started
What is the commit before the rebase started?
9439880 (HEAD -> fix-raj-bug) HEAD@{0}: rebase (finish): returning to refs/heads/fix-raj-bug9439880 (HEAD -> fix-raj-bug) HEAD@{1}: rebase (squash): fix: ensure part_list length and 'no' are integers4b7f473 HEAD@{2}: rebase (squash): # This is a combination of 3 commits.b2774c6 HEAD@{3}: rebase (squash): # This is a combination of 2 commits.2160f20 HEAD@{4}: rebase (continue): fix: ensure part_list length and 'no' are integersb6b63c7 HEAD@{5}: rebase (start): checkout b6b63c7b7d29f8 HEAD@{6}: rebase (abort): returning to refs/heads/fix-raj-bugb6b63c7 HEAD@{7}: rebase (start): checkout b6b63c7b7d29f8 HEAD@{8}: commit: fix bug: <---------- commit before rebase starts
In this case: the commit before the rebase started is: b7d29f8
- and it is NOT b6b63c7 HEAD@{7}
.
i.e. it is the commit BEFORE rebase (start)
.
Warning: Do not be deceived by the rebase (abort)
that occurs at HEAD@{6}
.
Reset to the correct commit
git reset --hard b7d29f8
...and keep working away
Use the following example to help you in your own git repo.
PS. The other answer(s) are great e.g. @CBBailey's. However they do not contain a worked example. e.g. how am I meant to go to this commit before the rebase started? This answer addresses that need in the market.