2016-12-22 36 views
0

我有一個在github上託管的git倉庫。爲什麼我在本地看到更多的遠程分支,然後我有github?

$ git fetch 
$ git branch 
* develop 
    kramer65/feature-branch 
    master 

我再登錄到github上,並在那裏我看到它只是有5個分支:

enter image description here

當我git branch本地我得到的只是三個分支,你在下面的輸出看所以,現在我做了git branch -a本地,這說明我的3個地方分支機構,加上約40遠程分支:

enter image description here

於是我試圖刪除遠程分支之一,但我不能:

$ git push origin :kramer65-feature-branch 
error: unable to delete 'kramer65-feature-branch': remote ref does not exist 
error: failed to push some refs to '[email protected]:MyOrganisation/therepo.git' 

任何想法,爲什麼我仍然可以看到這些回購與git branch -a

+3

我猜你沒有運行'git獲取-p' – Danh

+0

@Danh - 釘它。我不知道。謝謝! – kramer65

回答

3

一種可能的情況是有人爲發展創造一個分支,運行一個:

git fetch 

將獲取所有這些分支。當該功能分支被合併後,它們被刪除,並且git fetch未刪除它。您需要

git fetch -p 

git fetch --prune 
2

你需要remove任何remote-tracking引用no longer exist在遠程。

試試這個:

$ git fetch --prune 
$ git branch -a 

# more info 
$ git fetch --help 
相關問題