Undoing a Pushed Commit
A bad commit was pushed to the shared main an hour ago, and colleagues have pulled it. How do you undo it?
main
Choose one answer
git reset --hard HEAD~1 and git push --force
git reset --hard HEAD~1
git push --force
git revert <commit> and push the new commit
git revert <commit>
git commit --amend and push again
git commit --amend
Delete the branch on the remote, then push your local main again with the bad commit dropped