undo a git rebase code example
Example 1: git undo rebase
git reset --hard ORIG_HEAD
Example 2: undo git rebase
git reset --hard HEAD@{5}
Example 3: git undo rebase
git reflog # determine pre-rebase head number, N
git reset --hard HEAD@{N}
git reset --hard ORIG_HEAD
git reset --hard HEAD@{5}
git reflog # determine pre-rebase head number, N
git reset --hard HEAD@{N}