How do I reverse a commit in git?

后端 未结 6 1774

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:02

    You can do git push --force but be aware that you are rewriting history and anyone using the repo will have issue with this.

    If you want to prevent this problem, don't use reset, but instead use git revert

提交回复
热议问题