Skip to content

Instantly share code, notes, and snippets.

View webOS101's full-sized avatar

Roy Sutton webOS101

  • LG Silicon Valley Lab
View GitHub Profile
@aarontam
aarontam / prune_branches.sh
Last active February 26, 2016 19:27
Remove local branches that have already been merged.
# 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