Undo one pushed commit

How to undo one pushed commit (or more) with only one command

BE CAREFUL: make sure that the commit id is the correct one since the commits that you have deployed later will be lost.

If you want to remove some commits just use this command:

git push -f origin <last_good_commit_id>:<branch_name>

Source: Git documentation

For more interesting tutorials & guides just check them HERE.

Leave a Reply

Your email address will not be published. Required fields are marked *