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