How to delete multiple local Git branches from Sourcetree?

I used to end up having so many local branches in sourcetree branches section which I no longer user. Here is a quick way by which you can delete multiple branches all at once.

One option is to right-click on each branch and delete them. But that is not easy if you have too many branches.

Using Command line:

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

If you enjoyed reading this post, please share and give some claps so others can find it 👏👏👏👏👏 !!!!

iOS and tvOS developer, dreamer, photographer 🤨

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store