如何在删除分支时更新远程仓库的本地git跟踪

Hon*_*.Wu 1 git

比如,我已经删除了github.com中的patch-1分支,并运行git fetch origin更新本地repo来跟踪远程,但命令git branch -a仍显示我本地repo跟踪remotes/origin/patch-1.

$ git branch -a
* master
  origin
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
  remotes/origin/patch-1
Run Code Online (Sandbox Code Playgroud)

那么,如何更新我的本地回购?
谢谢!

jth*_*ill 6

你是在git fetch --prune/git fetch -p之后

-p
--prune

获取后,删除远程不再存在的任何远程跟踪分支.