git delete all branches but matser code example
Example 1: how to delete all branches except master
$ git branch | grep -v "master" | xargs git branch -D
Example 2: how to delete all branches in git except master
$ git branch | grep -v '^*' | xargs git branch -D