cancel local commit code example
Example 1: undo local commit
$ git reset --soft HEAD~1
Example 2: git delete local commit
git reset --hard origin/<branch_name>
$ git reset --soft HEAD~1
git reset --hard origin/<branch_name>