If you suffer from OCD like myself, you’ll likely be just as annoyed by the output of
git branch -a
which (in a well-used local repo) after a while will show a long list of remote branches (origin/blah) the vast majority of which no longer exist.
The solution to the annoyance (which makes it difficult to locate an actually useful remote branch in the middle of the clutter) is to run:
git remote prune origin
[Note – this does NOT touch `origin`, but only acts locally on your .git/remotes directory]
For more context, see this thread.
On the same note, please remember that
git push origin :stale_branch
is a thoughtful command to run regularly on your no-longer-used tracking remote branches, as a courtesy to your OCD-suffering colleagues 🙂