A local Git repository holds a copy of any remote branch that has ever been fetched. Even though remote branches (origin/…) may already have been deleted, the local copies of these branches are kept indefinitely if we do not delete them by hand.
The following command removes missing remote branches of remote origin:
git remote prune origin
For testing purposes we may add the option –dry-run.
References
- [1] git remote man page