How to undo a git push

This question already has an answer here:

  • How to undo the most recent commits in Git? 69 answers
  • Deleting a remote branch 4 answers

  • You just delete the remote reference

    git push origin :my_branch
    

    or with the current syntax

    git push --delete origin mybranch
    

    You'll also have to prune the local tracking branch from the local repo with

    git remote prune origin
    

    or as suggested by cupcake in the comments below,

    git fetch -p
    
    链接地址: http://www.djcxy.com/p/582.html

    上一篇: 我如何从我的回购中删除最新的提交?

    下一篇: 如何撤消git push