git branch --merged | egrep -v "(^*|master|dev)" | xargs git branch -d
# delete all merged branches (excludes master main and anything containing dev) git branch --merged | egrep -v "(^*|master|main|dev)" | xargs git branch -d