How do I delete a remote branch in Git?

This question already has an answer here:

  • How do I delete a Git branch both locally and remotely? 39 answers

  • git push origin :notmaster ,这基本上意味着“不向notmaster remote推送任何东西”。


    I had the same issue. I had both a branch and a tag named 3.2. That's why it says there's more than one match:

    git error: dst refspec 3.2 matches more than one.
    

    Here's how to delete the branch:

    git push origin :heads/3.2
    

    And here's how to delete the tag:

    git push origin :tags/3.2 
    

    git push origin --delete notmaster
    

    If you're using Git 1.7.0 or later, this will do the trick. Prior to Git 1.7.0, you needed to use the less intuitive (but equally effective) syntax:

    git push origin :notmaster
    

    The older syntax still works in newer versions of Git, but the newer syntax seems more humane and easier to remember. If I want to delete a branch, typing --delete seems like the natural thing to do.

    From the 1.7.0 release notes:

    "git push" learned "git push origin --delete branch", a syntactic sugar for "git push origin :branch".

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

    上一篇: 如何从NetBeans IDE中删除Git远程分支?

    下一篇: 如何删除Git中的远程分支?