Quick Tip - git delete merged branches

by on under Quick Tip
1 minute read

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.

quick tips, git, delete merged branches
Spotted a mistake in this article? Why not suggest an edit!
comments powered by Disqus