clear branches localy code example
Example 1: delete all local branches git
$ git branch | grep -v "master" | xargs git branch -D
Example 2: clean local branches git
git branch --merged master | grep -v '^[ *]*master$' | xargs git branch -d
$ git branch | grep -v "master" | xargs git branch -D
git branch --merged master | grep -v '^[ *]*master$' | xargs git branch -d