(requires bash or zsh, won't work with standard Bourne shell)
After pruning, you can get the list of remote branches with git branch -r
. The list of branches with their remote tracking branch can be retrieved with git branch -vv
. So using these two lists you can find the remote tracking branches that are not in the list of remotes.
1:
$ git fetch --prune
2: