CLI application that counts down until you commit
Commit until the time is up... or start over!
git-timer is a
node.js CLI application written in LiveScript that forces you to commit before a timer is up. It can be used for learning purposes (e.g. for a Code Retreat), or just for regular use, to keep a good commit pace.
$ npm install -g git-timer
When you run it, it starts a countdown timer. You are suppose to write code and commit before the time is up. If you don't commit, the repository is reset (using
git reset --hard) and the timer starts over. Else, if you commit before timeout, the timer simply resets, and you can move on to the next commit.
To make things more challenging, you can add another rule to the game, by only allowing yourself to commit when all tests pass. You can enforce that by adding a pre-commit hook that will run your test suite before commiting.
If you are developing a
node.jsproject and define
package.json), you just have to run
git-timer -g(see section Options below for details).
$ git-timer -hUsage: git-timer [options]Options:-h, --help output usage information-V, --version output the version number-m, --minutes [min] specify timeout in minutes-g, --green Allow only commits on green.node only - requires `npm test` to be defined.WARNING: adds a pre-commit hook to git
--minutesallows you to override the default timeout (5 minutes)
--greenenforces commits only on green, assuming
npm testis available. It basically creates a pre-commit script so that commits are allowed only if
npm testpasses. Notes
npm testwith the test command, inside the generated pre-commit script