Command line tool to help you clean up old git branches
NOTICE: Please use Ruby 1.9.3 (this gem relies on grit which is now unmaintained, and has issues with newer Rubies). Volunteers sought for upgrade to rugged.
A simple interactive command line tool to help you cleanup your git branch detritus.
This is what git-cleanup does:
GIT_EDITOR
). This makes it easy to determine whether the branch should be removed or not.Every destructive operation is interactive - nothing unexpected will happen to your repo. It’s perfectly fine to Ctrl-C
at any time if you get bored of deleting branches and want to do some real work.
Install the gem
$ gem install git-cleanup
Inside a git repo, just run git-cleanup
$ git-cleanup
Use --skip-unmerged
to ignore un-merged branches
$ git-cleanup --skip-unmerged
Use --only
to only consider branch names that have this substring
$ git-cleanup --only myname
Be careful, if you delete a critical branch it’s not my fault. Piping in yes
is a bad idea.
There are no tests, this was a quick hack to get the job done.
Pragmatic patches welcome, please open an issue first to discuss.