git delete branches that aren't on remote

C++
git branch -vv | grep ': gone]'|  grep -v "\*" | awk '{ print $1; }' | xargs -r git branch -Dgit fetch --all --prune
Source

Also in C++: