Pair programming does present some unique problems, one that we encountered at Hashrocket was commit attribution: a commit message would be identified with one member of the pair only. This is not exactly tragic, but from the perspective of a passioniate developer, having commit credit (and accountability) is a critical and visible part of the ethos.

Tim Pope had the brilliant idea of using a group email address with tags (such as group+you@example.com) to identify the commits a pair made to git. A little bash script fu lead to a nifty command line utility that let us track pairs with our git commits. With that script as a starting point, Ro Samour wrote a pure ruby implementation: hitch

hitch will modify your git configuration to reflect who you are pairing with. Here is a hitch commit message using git log --pretty=full:

commit e518dd0637e7d1d77d3bd79a645e5d0bc93eae2d
Author: Les Hill and Rogelio Samour <bleep+bleep+bleep@hashrocket.com>
Commit: Les Hill and Rogelio Samour <bleep+bleep+bleep@hashrocket.com>
Adding show note icon

This is a commit message from hitch on github:

Github hitch commit message

hitch is open source and is available from github.

Getting started

You will need to install the hitch gem from github1:

% sudo gem install therubymug-hitch

You will need a group email account with a service such as GMail that allows email tags2 (as an example, news is a tag in this email address yourname+news@example.com which is considered to be the same email address as yourname@example.com):

You really want a Gravatar for your group email account so that the commits show the custom gravatar along with your commit messages. For every pair, register a new gravatar and associate it with a tagged email address of the form:

dev+github_user_1+github_user_2@example.com

The github usernames should appear in the local part of the address in alphabetical order after the group address local part, each github username seperated by a +.

Initialize hitch by running hitchrc and giving it your name, github username, and group email address when prompted:

% hitchrc

Using hitch

To pair with another developer whose github username is pair:

% hitch pair

hitch will prompt you if it does not recognize github username of your pair and save it for later use.

To unpair and code solo:

% unhitch

To see who you are currently paired with:

% hitch

1 Add github.com to your gem sources with gem sources -a http://gems.github.com/

2 Read about email tags on Wikipedia

blog comments powered by Disqus