how to undo a commit before push code example
Example 1: cancel a commit not pushed
git reset --soft HEAD~
Example 2: undo commit git before push
git reset HEAD~
Example 3: undo git commit after push
git reset <hash> # Run this then merge, commit, and push