Last active
September 13, 2017 13:44
-
-
Save jjhamshaw/b1bbe06df83e12945307 to your computer and use it in GitHub Desktop.
scripts to clean up local git branches for a given repository
This file contains hidden or 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
# safe delete branches | |
# (deletes all MERGED branches, except dev and master) | |
git branch --merged | grep -v "\*" | grep -v master | grep -v dev | xargs -n 1 git branch -d | |
# delete branches | |
# (deletes all branches, except dev and master) | |
git branch | grep -v "\*" | grep -v master | grep -v dev | xargs -n 1 git branch -D |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment