Snippets

Craig Vincent git: Merged branch removal

Created by Craig Vincent
1
2
3
# http://stackoverflow.com/questions/6127328/how-can-i-delete-all-git-branches-which-have-been-merged
# include names of any branches you need to preserve in the grep statements to (i.e. in this case development doesn't want to be deleted)
git branch --merged | grep -v "\*" | grep -v master | grep -v development | xargs -n 1 git branch -d

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.