2014-06-30 20 views
0

當我使用git branch命令時,它顯示只有一個本地分支:master爲什麼我有兩個遠程主分支?

然而,當我使用git branch -a命令時,它顯示初始master分支以及兩個遠程主分支:
remotes/wilhelm/master
remotes/origin/master

爲什麼我有兩個遠程分支,如何在不刪除遠程回購的情況下刪除額外分支?

+2

這不是一個「額外」分支;顯然你在每個遠程倉庫都有一個「主」分支。如果你真的想刪除一個遠程分支,那麼請參閱答案。 [這裏](http://stackoverflow.com/questions/2003505/how-to-delete-a-git-branch-both-locally-and-remotely)。 –

+0

@OliCharlesworth我很困惑;我只有一個遠程存儲庫,但有兩個對同一個倉庫的引用。這是我的錯誤嗎? – Wilhelm

+0

@Wilhelm你怎麼知道他們都是相同的回購? 'git remote -v'的輸出是什麼?哦,等等,你已經把它刪除了嗎?那麼,這麼多......好吧,輸出是什麼呢?將其編輯到您的問題中。 –

回答

1

看起來您有兩個遠程存儲庫。 當然,他們每個人都有一個主分支,所以你有兩個遠程主分支。

您可以刪除遙控器與

git remote remove <name> 

這將刪除存儲庫,只能在本地回購不會跟蹤遠程回購了。

+0

我試着用'git remote remove remotes/wilhelm/master'刪除'remotes/wilhelm/master',但收到錯誤'error:Could not remove config section'remote.remotes/wilhelm/master'' – Wilhelm

+0

對不起,我沒有'不要讓自己清楚。你必須使用'git remote remove wilhelm' – toydarian

+0

這會從我的'.git/config'文件中刪除'[remote'Wilhelm']',但當我調用'git branch -a'時,遠程分支仍然會出現。 – Wilhelm

0

我結束了手動從我的.git/refs/remotes/文件夾中刪除分支。

我不會推薦任何一個做到這一點,除非:

  • 絕對必要
  • 或者您有困難放手[我做]
相關問題