git fetch prune

C++
git fetch --prune #is the best utility for cleaning outdated branches. It will connect to a shared remote repository remote and fetch all remote branch refs. It will then delete remote refs that are no longer in use on the remote repositorygit config --global fetch.prune true
Source

Also in C++: