git revert last rebase code example Example 1: git undo rebase git reset --hard ORIG_HEAD Example 2: git undo rebase git reset --hard HEAD@{5}