On 开发者_StackOverflowmy setup, this seems to work to delete a remote branch:
git push origin :foo
Because when I do it the first time, it's successful, but the second time, it fails because it says the remote branch is not there (as expected). So far so good.
This does not work:
git remote prune origin
It returns with no output, and all my local tracking branches for the deleted remotes are still there.
By "local tracking branches", do you mean branches you created to track remote branches? git remote prune
won't delete those. It'll only delete the remote branches (i.e., it'll delete origin/foo
, but not my-local-foo
that tracked origin/foo
).
You can confirm that origin/foo
was deleted by checking the output of
$ git branch -r
精彩评论