remove all local branches except master github desktop code example
Example 1: git delete all branches except master
git branch | grep -v "master" | xargs git branch -D
Example 2: how to delete all branches except master
$ git branch | grep -v "master" | xargs git branch -D