undo a commit from remote branch in git code example Example: how to undo a commit from remote git reset --hard HEAD~3 git push -f