delete last commit not pushed code example
Example 1: cancel a commit not pushed
git reset --soft HEAD~
Example 2: git delete last commit after push
git reset --hard HEAD~1
git push -f <remote> <branch>
git reset --soft HEAD~
git reset --hard HEAD~1
git push -f <remote> <branch>