git clear local branches code example
Example 1: delete all local branches git
$ git branch | grep -v "master" | xargs git branch -D
Example 2: git delete all branches except master
git branch | grep -v "master" | xargs git branch -D
$ git branch | grep -v "master" | xargs git branch -D
git branch | grep -v "master" | xargs git branch -D