Jacob Tomlinson's profile picture Jacob Tomlinson
Home Blog Talks Newsletter 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.


Have thoughts?

I love hearing feedback on my posts. You should head over to Twitter and let me know what you think!

Spotted a mistake? Why not suggest an edit!