Hi! I'm Nathan Hoad


Git: How to remove merged branches

If you've been a bit lazy and have old branches lying around then chances are, some of them have been merged and can be safely deleted.

To delete any branches that have been merged into the currently checked out branch then do this (you might want to git checkout master first):

git branch --merged | grep -v "\*" | xargs -n 1 git branch -d

Now you should have only the branches that are still under development.

If I just made your day a little better then thank me with a coffee or maybe a a pizza