Delete local branches that do not exist remotely.
$ git fetch --all --prune; git branch --verbose | grep ": gone]" | awk '{ print $1 }' | xargs --no-tags 1 git branch --delete --force
git branch --v | grep "[gone]" | awk '{print $1}' | xargs git branch -D
grep "[gone]"
will match everything that as 'g','o','n','e' characters (see https://www.gnu.org/software/grep/manual/html_node/Character-Classes-and-Bracket-Expressions.html)
So master
and other branches we probably don't want to delete will be included.
git fetch --all --prune; git branch -vv | grep ': gone]' | awk '{ print $1 }' | xargs git branch --delete --force