How do I reverse a commit in git?

后端 未结 6 1811

I\'m not really familiar with how git works. I pushed a commit by mistake and want to revert it. I did a

git reset --hard HEAD~1

Bewar

6条回答
  •  旧巷少年郎
    2020-12-23 20:14

    I think you need to push a revert commit. So pull from github again, including the commit you want to revert, then use git revert and push the result.

    If you don't care about other people's clones of your github repository being broken, you can also delete and recreate the master branch on github after your reset: git push origin :master.

提交回复
热议问题