我在github上托管了一个git repo。当我在本地git branch
时,我只得到你在下面的输出中看到的三个分支:
$ git fetch
$ git branch
* develop
kramer65/feature-branch
master
然后我登录到github并在那里我看到它只有5个分支:
所以现在我在本地做了一个git branch -a
,它显示了我的3个本地分支,以及大约40个远程分支:
然后我尝试删除其中一个远程分支,但我不能:
$ 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 'git@github.com:MyOrganisation/therepo.git'
知道为什么我仍然会看到git branch -a
的这些回购?
答案 0 :(得分:3)
一种可能的情况是有人为开发创建分支,您运行:
git fetch
将获取所有这些分支。合并该功能分支后,它们将被删除,而git fetch
并未将其删除。你需要
git fetch -p
或
git fetch --prune
答案 1 :(得分:2)
您需要remove
对遥控器remote-tracking
的所有no longer exist
个引用。
试试这个:
$ git fetch --prune
$ git branch -a
# more info
$ git fetch --help