Delete commits from a branch in Git

后端 未结 30 2016
醉话见心
醉话见心 2020-11-21 07:17

I would like to know how to delete a commit.

By delete, I mean it is as if I didn\'t make that commit, and when I do a push in the future, my changes wi

30条回答
  •  抹茶落季
    2020-11-21 08:01

    If you want to keep the history, showing the commit and the revert, you should use:

    git revert GIT_COMMIT_HASH
    

    enter the message explaining why are you reverting and then:

    git push  
    

    When you issue git log you'll see both the "wrong" commit and revert log messages.

提交回复
热议问题