I needed multiple branches excluded and found it somewhat difficult to actually do, but here's what finally worked for me:
1) Go find your actual global git config file and edit that. Trying to do it via command line was too hard with escaping and such
2) Make it look like this:
[alias]
trim = !git branch | grep -v -E 'master|main|development|integration|production' | xargs git branch -D
Should go without saying that each term after -E are the branches that WILL NOT be deleted.
I needed multiple branches excluded and found it somewhat difficult to actually do, but here's what finally worked for me:
1) Go find your actual global git config file and edit that. Trying to do it via command line was too hard with escaping and such
2) Make it look like this:
[alias]
trim = !git branch | grep -v -E 'master|main|development|integration|production' | xargs git branch -D
Should go without saying that each term after -E are the branches that WILL NOT be deleted.