开发者

Deleting a remote branch works, local pruning does not. why?

开发者 https://www.devze.com 2023-01-31 07:21 出处:网络
On 开发者_StackOverflowmy setup, this seems to work to delete a remote branch: git push origin :foo

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
0

精彩评论

暂无评论...
验证码 换一张
取 消