Git: Revert commit that has been pushed to origin

To bump off an accidental commit to origin, you'll have to sync your branch with the remote one.

Once that's done, we pop off the latest commit locally.

git reset HEAD^

The ^ means we're going back to the commit before "HEAD". Optionally you can use the option --hard to delete any changes made in that commit.

Now that we're back one commit, force it onto the remote master branch with +

git push origin +master

And that's it!

XJyGYChow Yun Fat approves of this method.

Source

 
Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog