As we use feature branching in our day-to-day workflow, we’ve got lots of branches left behind after work was complete. Mainly code that’s already merged into master…and so I’ve written a simple ruby script that:

1 Checks current branch

2 Warns if the current branch is not master

3 Prunes remotes

4 Checks merged branches

5 Shows the list of branches that will be removed

6 Asks for a confirmation to delete these branches

They should be safe to delete!

Here is the script: https://github.com/mapteo/clean-branches