Delete local branches except dev, master
git branch | grep -v -e dev -e master | xargs git branch -D
Delete remote branches except dev, master
git branch -r | grep -v -e dev -e master | cut -c 10- | xargs git push --delete origin
Delete local branches except dev, master
git branch | grep -v -e dev -e master | xargs git branch -D
Delete remote branches except dev, master
git branch -r | grep -v -e dev -e master | cut -c 10- | xargs git push --delete origin
git fetch --prune
might be useful too