2013-10-28 81 views
11

分支是無意中創建的。我想刪除它。事實上,我認爲我上週刪除了它,並且它沒有出現在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 

我必須怎麼做才能擺脫它?

回答

18

您正在尋找git remote prune,它可以去除陳舊的遠程分支機構。

刪除下的所有陳舊的遠程追蹤分支。這些陳舊的分支已從遠程存儲庫中刪除 ,但仍在本地「remotes /」中提供。

使用--dry-run選項,報告將修剪哪些分支,但不實際修剪它們。

在你的情況,你會想要使用git remote prune origin

+0

它也努力「檢查」分支,推到遠程,然後重新刪除它,但這當然更好。 – kojiro

+4

作爲一個例子, '混帳遠程修剪-n origin' 報告的是會得到修剪的起源,以及 '混帳遠程修剪origin' 實際進行修剪。 –

相關問題