Guided Branch Cleanup Utility
go get -u github.com/MCBrandenburg/gitclean
You can set standard branches to be ignored using the environment variable GITCLEAN_IGNORE
Example:
GITCLEAN_IGNORE=master,development
In the root of the project you want to clean, enter this in your prompt: gitclean
❰~/g/s/g/M/test(OK test3)❱(0)≻ git branch -l
development
master
test1
test2
* test3
❰~/g/s/g/M/test(OK test3)❱(0)≻ gitclean
GITCLEAN_IGNORE set to 'master,development'
Remove branch test1[y,N,q]? y
Remove branch test2[y,N,q]? n
The following branches will be deleted:
test1
Continue [y,N]? y
removing test1
Exiting
❰~/g/s/g/M/test(OK test3)❱(0)≻ git branch -l
development
master
test2
* test3
❰~/g/s/g/M/test(OK test3)❱(0)≻
❰~/g/s/g/M/testquit(OK test3)❱(0)≻ git branch -l
development
master
test1
test2
* test3
❰~/g/s/g/M/testquit(OK test3)❱(0)≻ gitclean
GITCLEAN_IGNORE set to 'master,development'
Remove branch test1[y,N,q]? y
Remove branch test2[y,N,q]? q
Exiting
❰~/g/s/g/M/testquit(OK test3)❱(0)≻ git branch -l
development
master
test1
test2
* test3
❰~/g/s/g/M/testquit(OK test3)❱(0)≻
❰~/g/s/g/M/testno(OK test3)❱(0)≻ git branch -l
development
master
test1
test2
* test3
❰~/g/s/g/M/testno(OK test3)❱(0)≻ gitclean
GITCLEAN_IGNORE set to 'master,development'
Remove branch test1[y,N,q]? y
Remove branch test2[y,N,q]? y
The following branches will be deleted:
test1
test2
Continue [y,N]? n
Exiting
❰~/g/s/g/M/testno(OK test3)❱(0)≻ git branch -l
development
master
test1
test2
* test3
❰~/g/s/g/M/testno(OK test3)❱(0)≻