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.
1. Click on your
Repository and select
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.