git delete all branches except master

Shell
git branch | grep -v "master" | xargs git branch -D
Source

Also in Shell: