「Git 2.7」远程分支删除后,git remote prune origin 无法批量删除分支

「描述」:一直有 PR 合并后,同时删除开发分支的习惯(有时候是自己删除,有时候是别人帮忙顺手删除)。之后在本地运行 git remote prune origin 却没有任何运行后的提示,也不生效。

这些分支都是我自己创建的,是否有着方面因素呢?

「环境」:

  • Git : 2.7.4
  • System : Ubuntu 16.4.38 x64
  • IDE: PHPStorm

「运行后,再 Checkout 一个远程不存在的分支结果」:

已经位于 'remove-bbs'
您的分支基于 'origin/remove-bbs',但此上游分支已经不存在。
  (使用 "git branch --unset-upstream" 来修复)

「Show Origin 结果」:

uiosun@uiosun-CW65S:/data/wwwroot/www.work1.com$ git remote show origin

* 远程 origin
  获取地址:git@github.com:Sun-FreePort/something.git
  推送地址:git@github.com:Sun-FreePort/something.git
  HEAD 分支:master
  远程分支:
    data-something       已跟踪
    something            已跟踪
    master               已跟踪
    mobile               已跟踪
    new-upload           已跟踪
    repeat-url           已跟踪
    revert-something     已跟踪
    search-params        已跟踪
    tag_branch           已跟踪
    task                 已跟踪
    waste-foreach        已跟踪
  为 'git pull' 配置的本地分支:
    master           与远程 master 合并
    publish-bug      与远程 publish-bug 合并
    remove-something 与远程 remove-something 合并
    repeat-url       与远程 repeat-url 合并
    search-params    与远程 search-params 合并
    update-banner    与远程 update-banner 合并
    upload-uat       与远程 upload-uat 合并
    waste-foreach    与远程 waste-foreach 合并
  为 'git push' 配置的本地引用:
    master        推送至 master        (最新)
    repeat-url    推送至 repeat-url    (最新)
    search-params 推送至 search-params (最新)
    waste-foreach 推送至 waste-foreach (最新)

类似大佬博客上的:refs/remotes/origin/3.1 stale (use 'git remote prune' to remove) 这种话,从未出现过。

我该怎么办,很困惑。

阅读 6.6k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进