Undo a Commit that has Already Been Pushed

InstructorChris Achard

Share this video with your friends

Send Tweet

Once a commit is pushed, you do NOT want to use git reset to undo it - because reset will rewrite the history tree, and anyone who has already pulled that branch will have a bad tree.

Instead, we'll use git revert to make a "revert commit" (like a merge commit), which will "undo" a specific commit. So the syntax is:

git revert [HASH-TO-UNDO]