See man git-fetch
, section “PRUNING”.
At one time, I had a couple dead remote tracking branches:
$ git branch -r origin/HEAD -> origin/master origin/WIP-syscall origin/master origin/proc-cmdline
On the next fetch, if the upstream branches no longer existed, delete the tracking branches:
$ git fetch --prune From https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux - [deleted] (none) -> origin/WIP-syscall - [deleted] (none) -> origin/proc-cmdline $ git branch -r origin/HEAD -> origin/master origin/master $
$ git remote prune <name>