Skip to content

Instantly share code, notes, and snippets.

@tsleyson
Created February 14, 2018 23:22
Show Gist options
  • Save tsleyson/e5eb3eb4ba898b0aa32c1c062ad1c8cc to your computer and use it in GitHub Desktop.
Save tsleyson/e5eb3eb4ba898b0aa32c1c062ad1c8cc to your computer and use it in GitHub Desktop.
Command to delete all local git branches
# I assigned this to an alias in .bash_profile.
# It gets rid of all your local git branches except for master and prod.
# I had to use command grep because I like to have alias grep='grep --color=auto -n -E'
# in my bash profile so I always have colors and extended regexes, but I don't want line numbers
# for this. (Adding that to the alias probably wasn't a good idea anyway.)
git branch | command grep -Ev '(master|prod)$' | xargs git branch -D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment