Clean non excluded git branches

Remove branches that have note been explicitly excluded (e.g. master) from the local repo

Albert Lacambra BasilAlbert Lacambra Basil

Clean all branches branches except master and development

git branch | grep -v '^* master$' | grep -v '^  master$' | grep -v '^* development$' | grep -v '^  development$' | xargs git branch -D

Clean all branches merged branches except master and development

git branch --merged | grep -v '^* master$' | grep -v '^  master$' | grep -v '^* development$' | grep -v '^  development$' | xargs git branch -d