Delete commits from a branch in Git

后端 未结 30 2049
醉话见心
醉话见心 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 07:39

    Take backup of your code in to temp folder. Following command will reset same as server.

    git reset --hard HEAD
    git clean -f
    git pull
    

    If you want to keep your changes , and remove recent commits

    git reset --soft HEAD^
    git pull
    

提交回复
热议问题