delete all local branches where the remote brnaches not exist git code example
Example: Remove All Local Branches not on Remote
$ git branch -r | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | xargs git branch -d
$ git branch -r | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | xargs git branch -d