git revert back to certain commit

This question already has an answer here:

  • How to revert Git repository to a previous commit? 38 answers

  • git reset --hard 4a155e5 Will move the HEAD back to where you want to be. There may be other references ahead of that time that you would need to remove if you don't want anything to point to the history you just deleted.


    You can revert all your files under your working directory and index by typing following this command

    git reset --hard <SHAsum of your commit>
    

    You can also type

    git reset --hard HEAD #your current head point
    

    or

    git reset --hard HEAD^ #your previous head point
    

    Hope it helps


    http://www.kernel.org/pub/software/scm/git/docs/git-revert.html

    using git revert will create new commits that revert the ones you dont want to have.

    an alternative: http://git-scm.com/docs/git-reset

    git reset will reset your copy to the commit you want

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

    上一篇: 恢复到Git中的特定提交

    下一篇: git恢复到某个提交