The following code does the following:
  1. Get every branch name
  2. Loop over the values
  3. Skip the branch named master
  4. Delete the branch without force


Run this code to setup the alias:
Code:
$ git config --global alias.cleanup '!git for-each-ref --format="%(refname:short)" refs/heads | grep -v 'master' | xargs git branch -d'
And this is how to use the alias:
Code:
$ git cleanup
Essentially the alias is used to delete any branches that are up-to-date, not master, and not the currently checked out branch. I created this alias because it makes the list much easier to reach when calling $ git branch. I hope you get find it useful!