有一个远程git分支,但没有匹配本地分支,如何删除远程分支

时间:2012-05-08 10:35:46

标签: 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...'

有什么想法吗?非常感谢:)。

1 个答案:

答案 0 :(得分: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