git-checklist: Maintain per-branch checklists in Git

[ desktop, development, program ] [ Propose Tags ] [ Report a vulnerability ]

Manage lists of TODO items for private branches from the command line. No configuration required and fast to learn, with human-editable storage format and comprehensive help information.


[Skip to Readme]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 1.0.0.0
Dependencies base (>=4.6 && <4.7), directory (>=1.2 && <1.3), filepath (>=1.3 && <1.4), optparse-applicative (>=0.7 && <0.8), parsec (>=3.1 && <3.2), pretty (>=1.1 && <1.2), process (>=1.1 && <1.2) [details]
License LicenseRef-GPL
Author Dougal Stanton
Maintainer dougal@dougalstanton.net
Category Desktop, Development
Home page https://github.com/dougalstanton/git-checklist
Bug tracker https://github.com/dougalstanton/git-checklist/issues
Source repo head: git clone https://github.com/dougalstanton/git-checklist
Uploaded by dougalstanton at 2014-01-06T21:44:30Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Executables git-checklist
Downloads 1231 total (4 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
Successful builds reported [all 8 reports]

Readme for git-checklist-1.0.0.0

[back to package description]

Git Checklist

I was juggling lots of private git branches at work and making some use of the branch description file (see git branch --edit-description) to store my notes for each branch. This was good for me because the descriptions aren't committed to the branch so they would never make it upstream (even by accident). However managing the TODOs themselves was pretty unwieldy.

And so was born git-checklist, though in actual fact I've aliased it to git todo. Assuming it's in your path:

$ git config alias.todo=checklist

Otherwise, like this:

$ git config alias.todo=!/path/to/git-checklist

Using It Is Easy

To view your TODOs, just enter the bare command from a git repository:

$ git todo

Well, if you've not got anything to do yet, it won't have anything to show you. Find out where to go next:

$ git todo --help
Usage: git-checklist [COMMAND]
  Per-branch TODO list for Git repositories

Available options:
  -h,--help                Show this help text

Available commands:
  show                     Show current TODOs
  add                      Add a TODO
  done                     Mark a TODO as done.
  undo                     Item needs redone!
  remove                   Remove a TODO (can't be undone)
  stats                    Summary statistics of checklist

It will give you a summary of the commands you can enter at this point. There are no entries yet so all you can do is add them.

$ git todo add Add an informative README file
1: [ ] Add an informative README file

Each entry has a number in the left column and a box. Empty boxes mean the item is still to be done. When you've finished a task, mark it done using the number as a reference:

$ git todo done 1
1: [x] Add an informative README file

You can also "undo" items if you realise that the fix you made wasn't so hot after all, or you didn't understand the issue fully, or whatever other reason.

Finally you can remove items entirely from the list. This is permanent and can't be undone.

Advanced Usage

If you're knee deep in work on one branch and you'd like to change the checklist for another branch, all the commands will recognise the --branch (or -b) option.

$ git todo add --branch newparser Make nicer error messages

If you want to start a description of your note with a hyphen you can separate it from the rest of the command options with a double-hyphen on its own.

$ git todo add -- -b stopped working but --branch still okay

If you want to see all your branches at once use

$ git todo show --all

Obviously you can't supply the --all flag to any of the editing commands --- you can only edit one branch's checklist at a time.

There is one more overview command that will take --branch or --all as an option:

$ git todo stats
2 tasks to do (4 in total)

Work In Progress Commits

I've got an alias called wip which lets me quickly save all my unsaved work in the current branch. You can use this as a basic command:

$ git config alias.wip=commit -a -m"WIP"

But if you use git-checklist the following might be more informative when you are trying to get the measure of your branches:

$ git config alias.wip=!git commit -a -m\""WIP $(git todo stats)"\"

Then you'll get a commit that says something like WIP 2 tasks to do (4 in total which is much nicer. For the cherry on top I also use prepare-commit-msg to pipe the result of git todo show to the commit message. The summary line will contain a summary and the rest of the message will contain the current state of the branch.

Background Details

The checklists are stored in .git/checklist/<branchname>. The serialised form is basically just the checklists without the number prefix. This is similar to the checklist format used by GitHub's extended Markdown, so you can re-use the file contents if desired.

The format is very easy to read and edit manually.

[ <mark> ] <space> <description> <newline>

The is either "x" for a completed item or a space otherwise. (The parser will accept any non-"x" as pending but will always write a space.) The description must not contain a newline but is otherwise freeform.

The checklist for the working directory is whatever branch name is pointed to by HEAD. I have not tested it with a detached head, though I guess you'd just end up with a SHA as a branch name.

Installing It Is Fairly Easy

Assuming you've got a Haskell installation (if not, [grab the Haskell platform] hp) you can grab the source and build with Cabal.

$ git clone http://github.com/dougalstanton/git-checklist
$ cd git-checklist
$ cabal build
$ cabal install

Shortcomings

The data is stored in a separate directory inside .git which isn't versioned --- this is a local list only. I am open to suggestions to make this versioned though it is not a priority for me. My workflow is based around a single computer.

The read/write step bashes into the awkwardness of lazy IO.

It doesn't cope very well with not being somewhere inside a repository. It shouldn't wreck anything but the error message isn't very refined.

Upgrading

If you were using a pre-1.0 version the file format has changed incompatibly. There is a secret flag to upgrade:

$ git-checklist --upgrade

Alternatively you can do it manually before you upgrade the application like this. The key part is to strip the first four characters from each line, ie the number--colon--space prefix.

for b in .git/checklist/* ; do
    git-checklist show --branch $(basename $b) | cut -c 5- > $b
done