git remote undo last commit code example Example 1: git delete last commit in remote 1 $git rebase -i HEAD~2 Example 2: git delete last commit in remote $git rebase -i HEAD~2