how to cancel commit in github code example Example 1: git undo last commit Click to copy$ git reset --soft HEAD~1 Example 2: undo local commit Click to copy$ git reset --soft HEAD~1