Created
February 14, 2018 23:22
-
-
Save tsleyson/e5eb3eb4ba898b0aa32c1c062ad1c8cc to your computer and use it in GitHub Desktop.
Command to delete all local git branches
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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