$ git branch --merged | egrep -v 'master|develop' | xargs -n 1 git branch -d
You can safelist more branches in egrep -v 'master|develop|foo|bar'
From us to your inbox weekly.