Once you start working on feature branches you often find that you have a bunch of local branches that are tracking remote branches that no longer exist.
One easy way of keeping your local and remote repositories in sync is to use the prune option of the Git remote command:
git remote prune <remote name>
git remote prune origin
From the docs:
Deletes all stale remote-tracking branches under
. These stale branches have already been removed from the remote repository referenced by , but are still locally available in “remotes/ ”.
With –dry-run option, report what branches will be pruned, but do not actually prune them.
This will remove all local references that track remote branches that have been deleted and keep your local repository clean and tidy. :)