2012-05-08 77 views
0

以下命令:有一個遠程的Git分支卻敵不過當地的分支機構,如何刪除遠程一個

$ git branch -a

產生

* develop 
    master 
    remotes/origin/HEAD -> origin/develop 
    remotes/origin/develop 
    remotes/origin/feature/foo 
    remotes/origin/master 

,但我不想remotes/origin/feature/foo分支。我能做些什麼來做到這一點?我如何刪除它?

我已經試過這樣:

git push origin --delete origin/feature/foo

,但我得到這個:

error: unable to push to unqualified destination: origin/feature/foo 
The destination refspec neither matches an existing ref on the remote nor 
begins with refs/, and we are unable to guess a prefix based on the source ref. 
error: failed to push some refs to '...my remote repo...' 

任何想法?非常感謝 :)。

回答

3

當你調用

git push origin feature/foo 

git真的看到

git push origin feature/foo:feature/foo 

什麼意思「推feature/foo(左側)到遠程數據庫feature/foo(右側)。

隨着

git push origin :feature/foo 

您將「無」推送到feature/foo