Git僵尸分支不会消失

时间:2016-09-09 17:26:32

标签: git github

每当我git pull时,Git都会告诉我有一个新的分支:

$ git pull
From github.com:MyAccount/myproject
 * [new branch]      brand/features/xyz -> origin/brand/features/xyz
Already up-to-date.

$ git pull
From github.com:MyAccount/myproject
 * [new branch]      brand/features/xyz -> origin/brand/features/xyz
Already up-to-date.

在GitHub中,有一个名为brand/features/xyz的分支,但是当我在终端中列出远程分支时,我只看到一个名为Brand/features/xyz的分支:

$ git branch -a
* develop
  master
  remotes/origin/HEAD -> origin/develop
  remotes/origin/Brand/features/xyz
  remotes/origin/develop
  remotes/origin/master

我觉得需要修剪一些东西,但它并没有解决问题:

$ git remote prune origin
Pruning origin
URL: git@github.com:MyAccount/myproject
 * [pruned] origin/Brand/features/xyz

$ git branch -a
* develop
  master
  remotes/origin/HEAD -> origin/develop
  remotes/origin/develop
  remotes/origin/master

$ git pull
From github.com:MyAccount/myproject
 * [new branch]      brand/features/xyz -> origin/brand/features/xyz
Already up-to-date.

$ git branch -a
* develop
  master
  remotes/origin/HEAD -> origin/develop
  remotes/origin/Brand/features/xyz
  remotes/origin/develop
  remotes/origin/master

"品牌"一定有问题。 vs"品牌",但我该如何解决?

1 个答案:

答案 0 :(得分:2)

您可能会误解git remote prune,这会删除已远程删除的分支的本地版本。试试following command

git push origin --delete Brand/features/xyz