Refreshing locally remote branches that have been deleted in git

Problem

You would like to refresh your local git repository after deleting some remote branches, usually after merging them to a develop,master etc repository, so doing branch -a or branch -r would not display them anymore.

Solution

You would need to issue the following git command:

git remote prune origin

And then doing a branch -r or branch -a should not display the deleted remote branches anymore.