siteground

Sometimes after you push some commits to the remote, you realize that there is a mistake. So you need to revert all of the commits that already pushed. To do so, run these commands:

git checkout master
git reset --hard e3f1e37
git push --force origin master

Where e3f1e37 is the commit you what to reset to.

Running first 2 commands will reset your code to the commit e3f1e37 in --hard mode. That means Git will remove all your local changes.

The final command runs a forced push, telling the remote to update the branch to the same as your local branch.

Leave a Reply