无意中创建了一个分支。我想删除它。事实上,我认为我上周删除了它,并且它没有出现在bitbucket的搜索中,所以我倾向于认为问题只在我的本地回购中。为什么分支在执行此操作后仍会显示在我的本地仓库中?
$ git branch -d ebc_193_157_154_order_creation_xsd_validation_and_refactored_code
error: branch 'ebc_193_157_154_order_creation_xsd_validation_and_refactored_code' not found.
$ git push bitbucket :ebc_193_157_154_order_creation_xsd_validation_and_refactored_code
error: unable to delete 'ebc_193_157_154_order_creation_xsd_validation_and_refactored_code': remote ref does not exist
error: failed to push some refs to 'bitbucket.org:trueaction/eb2c'
仍然存在:
$ git branch -r | grep ebc_193
bitbucket/ebc_193_157_154_order_creation_xsd_validation_and_refactored_code
$ git branch -a | grep ebc_193
remotes/bitbucket/ebc_193_157_154_order_creation_xsd_validation_and_refactored_code
我该怎样做才能摆脱它?
答案 0 :(得分:22)
您正在寻找git remote prune
来移除陈旧的远程分支。
删除所有陈旧的远程跟踪分支。这些陈旧的分支已被删除 从远程存储库引用,但仍在本地可用“remotes /".
使用--dry-run选项,报告将修剪哪些分支,但实际上不要修剪它们。
在您的情况下,您需要使用git remote prune origin
。