How to undo several Git commands?

This question already has an answer here:

  • How to move HEAD back to a previous location? (Detached head) 3 answers

  • To undo a specific commit from the last known good commit, first look at the git log and you should see this in the shell:

    commit: your40characterSHA1codehere # copy this into the clipboard
    Author: your name here with email address
    date: date-here
    
    Commit message here
    

    You should copy the commit sha1 code, then perform git reset --hard your40characterSHA1codehere and git push origin master --force to force push the master or other branches you worked on. Hope this helps!

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

    上一篇: 如何恢复从git提交更改?

    下一篇: 如何撤消几个Git命令?