Last active
February 26, 2016 19:27
-
-
Save aarontam/560aed7e0ecef79c7550 to your computer and use it in GitHub Desktop.
Remove local branches that have already been merged.
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
# Excludes master, by default; other branches can be added with an additional pipe i.e. | grep -v dev | |
# Update "[branch_to_check_against]" to be the branch where the to-be-pruned branches have been merged into (by default, this is master) | |
# Adapted from http://stackoverflow.com/a/18143078/1569595 | |
git pull && git branch --merged [branch_to_check_against] | grep -v "\*" | grep -v master | grep -v [branch_to_check_against] | xargs -n 1 git branch -d |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment