Find by pattern and delete multiple branchs in Git

☕️ 1 min read

On the first part of the code git branch -D you’ll force to delete the branch and you can pass in the second part using grep -E (--extended-regexp - PATTERN is an extended regular expression (ERE)).

i.e:

git branch -D `git branch | grep -E 'name-*'`

https://stackoverflow.com/questions/3670355/can-you-delete-multiple-branches-in-one-command-with-git