git delete all branches starting with code example
Example 1: delete all local branches git
$ git branch | grep -v "master" | xargs git branch -D
Example 2: grep remove branches
Type in git branch | grep "<pattern>" for a preview of the branches that will be deleted.
Type in git branch | grep "<pattern>" | xargs git branch -D.
Example 3: how to delete all branches in git except master
$ git branch | grep -v '^*' | xargs git branch -D