Delete all branch except master


$ git branch | grep -v "master" | xargs git branch -D 

Instead of master if you can also delete other branch by replacing with any branch name

$ git branch | grep -v "<branch-name>" | xargs git branch -D