Deleting a remote branch

后端 未结 4 1850
慢半拍i
慢半拍i 2020-12-18 06:04

When I perform branch -a:

$ git branch -a
* master
 remotes/origin/HEAD -> origin/master
 remotes/origin/hello
 remotes/origin/master
         


        
4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-18 06:44

    Note that git branch only allows for deleting local references.

     git branch -r -D origin/hello
    

    That only delete the local pointer to a remote tracking branch, but that has no influence on the remote repo content itself.
    Only the git push origin :hello, as mentioned in the other answers, would do that.

    Plus, that doesn't change the config branch.hello.fetch: it still references origin/hello, which is why the next fetch will re-create the remote tracking branch in your local repo.

提交回复
热议问题