How can I undo a `git commit` locally and on a remote after `git push`

后端 未结 7 1098
隐瞒了意图╮
隐瞒了意图╮ 2020-12-02 03:28

I have performed git commit followed by a git push. How can I revert that change on both local and remote repositories?

$ git log
         


        
相关标签:
7条回答
  • 2020-12-02 04:15

    Generally, make an "inverse" commit, using:

    git revert 364705c
    

    then send it to the remote as usual:

    git push
    

    This won't delete the commit: it makes an additional commit that undoes whatever the first commit did. Anything else, not really safe, especially when the changes have already been propagated.

    0 讨论(0)
提交回复
热议问题