git how to undo a rebase code example Example 1: git undo rebase git reset --hard ORIG_HEAD Example 2: git undo rebase git reset --hard HEAD@{5}