Andrew Andrew - 1 month ago 11
Git Question

SourceTree delete all local branches under a specific directory

In SourceTree, I have about 30 branches showing up in the directory tree under a custom directory, it looks like this:

> File Status
> Branches
>completed_branches
>branch1
>branch2
>branch3
>branch4
...
> Tags
> Remotes
> Stashes


Is there a git command or SourceTree button to delete all branches named
/completed_branches/*
? Ideally I could just right click the folder in the directory tree and click delete, but that doesn't exist.

Answer

you can run the command, grabbing all branches with completed_branches, and executing the delete command on them.

 git branch | grep "completed_branches" | xargs git branch -D