Sometimes you remove a branch via web (github, gitlab…) but you still have its reference when you run:

$ git branch -a
remotes/origin/featur-cool-feature-we-are-working-right-now
remotes/origin/feature-removed-long-ago # This guy is about to die!

You can eliminate the old references by running

$ git remote prune {target}

Where target will be most likely “origin”.

$ git remote prune origin
URL: git@github.com:my_user/my_project.git
 * [pruned] origin/featur-removed-long-ago

Source.