Bulk Delete Local Git Branches

I usually write about dumb statistics that I’ve found with free data on the web, but today I got incredibly frustrated with a particular feature of Git that I thought I would change it up a bit. If you aren’t a developer, you can probably remove this post from your reading list, otherwise read on!

One of the most popular Git “branching strategies” right now in the programming world is the use of GitFlow. Basically a series of very small branches for features. Each branch lasting a day or so (Sometimes less). The usual process is that you create a branch to your work, push it to remote, create a pull request, and then create a new branch off development to start the next feature while you wait for a code review. Once the code review is completed you can merge the remote branch into development on Github all nice and easy. But what happens to your local branch? Most of the time it just sits there until you end up with this :


Essentially hundreds of branches left stranded local machine with no way to get rid of them in one nice operation.

I searched around for a tool that would allow me to bulk select branches and then delete them all in one go rather than having to delete each branch one by one. I found command line scripts that would go through each branch one by one, and allow me to type “Y” to delete that branch. But still that seemed cumbersome. With a bit of spare time I create an extremely simple tool with a tree view, that allows you to delete a whole handful of branches all in one go. It’s a bit rough around the edges since I got it to do what I wanted to do then stopped, but it works!


I’ve uploaded the full source to Github here : https://github.com/mindingdata/GitBranchDeleter

As always, Pull requests welcome.

Bulk Delete Local Git Branches