git remove commit from local and remote code example
Example 1: delete a pushed commit
# delete the last commit
$git reset –hard HEAD~
Example 2: how to undo a commit from remote
git reset --hard HEAD~3
git push -f
# delete the last commit
$git reset –hard HEAD~
git reset --hard HEAD~3
git push -f