If you’re working on a Git repository and your team makes exhaustive use of branches, every time you run
git fetch, Git will download new commits on those remote branches, even if you don’t plan on having local branches tracking their remote pair. Once those branches are removed by your teammates in your remote repositories,
git fetch won’t download new commits for those branches, but it won’t notify you that the branch has been removed either.
If you want to remove remote branches in your local repository that have been already removed from the remote repository, you can run
git fetch --prune. This will download new commits from existing or new branches, but also if a branch has been removed from the remote repository, you’ll have that branch removed from your local copy as well.
If you don’t want to forget about prune, you can also configure your Git repository to automatically prune removed branches by running
git config remote.origin.prune true. Replace
origin with the name of the remote repository you have the setting to have effect on. Every time you run
git fetch on that remote, deleted branches will get removed too.