How do I reverse a commit in git?

后端 未结 6 1817

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

    Or you can try using git revert http://www.kernel.org/pub/software/scm/git/docs/git-revert.html. I think something like git revert HEAD~1 -m 1 will revert your last commit (if it's still the last commit).

提交回复
热议问题