Delete Multiple git Branches with a Single Command
I’ve adopted a branching model similar to The Diaspora* Project in which branches are prefixed with feature/*, _bug/_, etc. I was looking to remove several feature branches and ran across the following command on Stack Overflow.
Consider feature to be a variable, replace feature with any string that is common among all the names of all branches to be deleted.
git branch -D $(printf "%s\n" $(git branch) | grep 'feature')