Jacob Tomlinson's profile picture Jacob Tomlinson
Home Blog Talks About

Quick Tip - git delete merged branches

1 minute read #quick-tips, #git, #delete-merged-branches

Here’s a quick line to run in your terminal to delete all local git branches which have already been merged into master.

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

This is a nice safe command which will only remove branches which have already been merged.