git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d
$ git branch -r --merged | egrep -v "(^*|master|dev)" | xargs -n 1 git push --delete origin