删除远程分支有效,而本地修剪则无效。为什么?
在我的设置中,这似乎可以删除远程分支:
git push origin :foo
因为当我第一次执行此操作时,它是成功的,但第二次,它失败了,因为它说远程分支不存在(如预期的那样)。到目前为止,一切都很好。
这不起作用:
git remote prune origin
它返回时没有输出,并且已删除遥控器的所有本地跟踪分支仍然存在。
On my 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“本地跟踪分支”是指您为跟踪远程分支而创建的分支吗?
git Remote prune
不会删除这些。它只会删除远程分支(即,它将删除origin/foo
,但不会删除跟踪origin/foo
的my-local-foo
代码>)。您可以通过检查输出来确认
origin/foo
已被删除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 deleteorigin/foo
, but notmy-local-foo
that trackedorigin/foo
).You can confirm that
origin/foo
was deleted by checking the output of