How to delete all local branches that have already been merged

Development

,

Tips and Tricks

Sometimes happens that the local repository is not very well maintained for many reasons and so the need to delete all local branches that have already been merged.

Here is an example of what the command looks like:

git branch --merged | egrep -v "(^\*|master|develop)" | xargs git branch -d

But if you just want to check what these branches are then:

git branch --merged | egrep -v "(^\*|master|develop)"

Share This :