git branch | grep -v 'master$' | xargs git branch -D
REMOTE_NAME="origin"
command -v parallel || brew install parallel
git branch -r | grep $REMOTE_NAME/ | grep -v 'master$' | grep -v HEAD | cut -d/ -f2- | parallel git push $REMOTE_NAME --delete
Just add the following after grep -v 'master$'
to one of the above two commands:
| grep -v 'branch_name_to_exclude'
👍