What is Jig

Jig is a Git pre-commit hook on steroids.

Git Hooks are little scripts that you can place in your $GIT_DIR/hooks directory to trigger actions at certain points. The pre-commit hook is useful for performing actions right before Git writes a commit.

Jig is a command line tool as well as a utility for creating and running “plugins”.

It has a set of common plugins that will probably be useful to you right now, but the real goal is to make it easy for you to write your own.

Install it

The Jig command line tool is written in Python and is available on PyPi.

$ pip install jig || easy_install jig

This is just a little shell trick that uses easy_install if it can’t locate pip.

Jig currently supports Python 2.6 and Python 2.7.

Test drive

Change directories into your Git repository and initialize it to use Jig.

$ cd myrepo
$ jig init .
Git repository has been initialized for use with Jig.

You should tell Git to ignore the new .jig directory. Run this:

    $ echo ".jig" >> .gitignore

Next install some plugins. Jig has a common set you may like:

    $ curl -L https://raw.github.com/robmadole/jig-plugins/lists/common.txt > .jigplugins.txt
    $ jig install .jigplugins.txt

Create a file that lists the plugins you’d like to install.

$ curl -L https://raw.github.com/robmadole/jig-plugins/lists/common.txt > .jigplugins.txt
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    97  100    97    0     0    144      0 --:--:-- --:--:-- --:--:--   425

Install the Jig plugins.

$ jig install .jigplugins.txt
From http://github.com/robmadole/jig-plugins@whitespace:
 - Added plugin whitespace in bundle jig-plugins
From http://github.com/robmadole/jig-plugins@woops:
 - Added plugin woops in bundle jig-plugins

Run the plugins in the current repository with this command:

    $ jig runnow

Jig works off of your staged files in the Git repository index.
You place things in the index with `git add`. You will need to stage
some files before you can run Jig.

Stage some changes and then commit.

$ git add mylib.py

Jig will run and let you know if it catches anything.

$ git commit -m 'Adding my awesome new library'
▾  woops

⚠  line 23: mylib.py
    print statement

Ran 1 plugin
    Info 0 Warn 1 Stop 0

Commit anyway (hit enter), or "c" to cancel the commit

Change log

Release 0.1.11 - February 28th, 2015

  • Removes references to the async Python library which is no longer needed by gitdb. Fixes #11.

Release 0.1.10 - July 23rd, 2014

  • Fixed references to downloading files from GitHub after a security update redirects all requests to githubusercontent.com

Release 0.1.9 - February 22nd, 2014

  • Adds a jig sticky command that auto-initializes freshly cloned Git repositories for use with Jig.

Release 0.1.8 - February 1st, 2014

  • Adds a jig report command allowing Jig to be ran on any Git revision range.
  • Adds a jig version to show the currently installed version of Jig.

Release 0.1.7 - December 13th, 2013

  • Fix a missing string to unicode conversion that could cause errors if unicode characters were present in the input sent to plugins.

Release 0.1.6 - April 28th, 2013

  • jig config command added, allowing plugin configuration settings to be managed.

Release 0.1.5 - April 10th, 2013

  • jig runnow supports a --plugin option so that only a specific plugin is ran.
  • jig plugin test has a new --range option to limit the tests ran to a specific set instead of the entire suite.

Release 0.1.4 - March 24th, 2013

  • Jig commands now include more useful messages.
  • Periodically checks if installed plugins have updates and prompts to install the latest plugins.
  • Ignores the .jig directory when running (GitHub Issue #1).

Release 0.1.3 - February 16th, 2013

  • Makes the indicator between warning messages and stop messages easy to discern at a quick glance.
  • When Jig runs via the Git pre-commit hook, the output is more pronounced.
  • Update the plugin test runner to ignore the summary lines at the bottom of the output.

Release 0.1.2 - February 13th, 2013

  • Support for Python 2.6 when running plugins jig plugin test.

Release 0.1.1 - February 7th, 2013

  • Upgrade plugins installed from a URL using jig plugin update.
  • Python 2.6 support.

Release 0.1.0 - April 6th, 2012

  • Initial release.

License

Jig is licensed under a BSD license.