The following command chain can be used to delete local branches:
git branch --v | grep "\[gone\]" | awk '{print $1}' | xargs git branch -D
git branch --vlists the local branches verboselygrep "\[gone\]"finds all the branches whose remote branch is goneawk '{print $1}'outputs only the name of the matching local branchesxargs git branch -Ddeletes all the matching local branches
This should work on MacOS as well as *nix environments.