Skip to content
Simple git branch curation tool
Branch: master
Clone or download
Latest commit 475d738 Apr 22, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
assets Update gif in README to show "vs remote" column Mar 11, 2019
bin Initial commit Jul 16, 2018
exe Tidy up code structure Mar 31, 2019
lib v0.5.0 Apr 22, 2019
.gitignore
CHANGELOG.md v0.5.0 Apr 22, 2019
Gemfile Add missing runtime dependencies to gemspec. Jul 16, 2018
Gemfile.lock Merge branch 'master' into next-minor-version Apr 22, 2019
LICENSE.txt Initial commit Jul 16, 2018
README.md Document --list option in README Mar 31, 2019
Rakefile v0.2.0 Jul 16, 2018
VERSION v0.5.0 Apr 22, 2019
git_curate.gemspec Merge branch 'master' into next-minor-version Apr 22, 2019

README.md

git curate

Gem Version

Demo

Motivation

After a while, my local repo becomes cluttered with branches, and git branch outputs an awkwardly long list. I want to delete some of those branches to bring that list back under control; but I can't always remember which branches I want to keep from the branch names alone; and inspecting them one at a time and then running git branch -D in a separate step, is painful.

git curate is intended to ease this pain. It steps you through the local branches of a repo one at a time, outputting the following information about each:

  • Last commit date
  • Last commit author
  • Last commit subject
  • Whether the branch has been merged into the current HEAD
  • The status of the branch relative to the upstream branch it is tracking (if any)

You can then select whether to delete or keep each branch as you go.

NOTE git curate does not run git fetch prior to generating its output. If you want to be sure that the "Status vs upstream" column reflects the latest state of the upstream branches as per their remote repository, you should run git fetch first.

Installation

You'll need Ruby v2.1.10 or higher. Run

gem install git_curate

to install the executable.

Usage

From within a git repo, run:

git curate

This will step you through your local branches one at a time, asking you whether to keep or delete each branch in what should be a fairly self-explanatory fashion. Note the branch you are currently on will not be included in the list, as git does not allow you to delete the branch you're on.

If you just want to view the information about your local branches without stepping through them interactively, enter git branch --list or git branch -l.

(Note the space after git—we have effectively added a subcommand to git just by installing a gem. When git_curate is installed, an executable is created called git-curate. In general, for any executable of the form git-xyz in your PATH, git will automatically recognize xyz as a subcommand, and will run that executable whenever that subcommand is invoked.)

Contributing

Bug reports and pull requests are welcome on GitHub.

To start working on git_curate, git clone and cd into your fork of the repo, then run bin/setup to install dependencies.

For a list of Rake tasks that are available in the development environment, run rake -T.

License

The gem is available as open source under the terms of the MIT License.

You can’t perform that action at this time.