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.

1. Click on your Repository and select Branch option.

2. Then click on Delete branches option and it will list all the branches both local and remote.

Just check all the branches that you want to delete and click on Delete Branches .

Note: Make sure you don’t delete any Remote branch which is important.

Using Command line:

To delete all local branches that are already merged into the currently checked out branch:

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

You can refer this Stackoverflow Post for more details on deleting branches via commandline.

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

You can follow me on Medium for fresh articles. Also, connect with me on LinkedIn.

If you have any comment, question, or recommendation, feel free to post them in the comment section below!

iOS and tvOS developer, dreamer, photographer 🤨