how to clear local branches git 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
Example 3: How to Delete Local/Remote Git Branches
$ git branch -r | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | xargs git branch -d