How to undo a commit on a GitHub repo?

This question already has an answer here:

  • How to undo the most recent commits in Git? 69 answers

  • Find the SHA1 of the commit you want to be the latest one on the github repo. This will probably be the commit right before the ones you didn't want to push.

    Then on your old repo do: git reset --hard git push --force origin master

    (or whatever remote and branch names you have)

    This should do the job. Also make sure that everyone who has pulled/cloned the "bad" commit too removes it using these commands, otherwise it'll get pushed again when they push.

    链接地址: http://www.djcxy.com/p/578.html

    上一篇: 撤消上次提交,但保持存储库不变

    下一篇: 如何撤消对GitHub仓库的提交?