我的情况是...在同一仓库中工作的某人已从其本地和远程仓库中删除了一个分支...
大多数在Stack Overflow或其他站点上询问过此类问题的人,分支的问题仍显示在git branch -a
底部的远程跟踪分支列表中:
* master
develop
feature_blah
remotes/origin/master
remotes/origin/develop
remotes/origin/feature_blah
remotes/origin/random_branch_I_want_deleted
但是,在我的情况下,不应存在的分支是本地的:
* master
develop
feature_blah
random_branch_I_want_deleted
remotes/origin/master
remotes/origin/develop
remotes/origin/feature_blah
当我执行以下任何操作时,不会在本地删除它:
$ git prune
我也尝试过:
$ git remote prune origin
$ git fetch --prune
更有用的信息:当我检查git remote show origin
这是它的外观时:
* remote origin
Fetch URL: utilities:homeconnections_ui.git
Push URL: utilities:homeconnections_ui.git
HEAD branch: master
Remote branches:
master tracked
develop tracked
feature_blah tracked
other123 tracked
other444 tracked
other999 tracked
Local branches configured for 'git pull':
develop merges with remote develop
feature_blah merges with remote other999
master merges with remote master
random_branch_I_want_deleted merges with remote random_branch_I_want_deleted
Local refs configured for 'git push':
develop pushes to develop (local out of date)
master pushes to master (up to date)
feature_blah pushes to feature_blah(up to date)
请注意,它仅在标题为 Local branches configured for 'git pull':
为什么?
x/y
)时有细微的差别:它已得到修复(请参见下面的答案)
git branch -d the_local_branch