When we pair program at Barsoom, we’ve started making commits in both users’ names.
This emphasizes shared ownership and makes commands like
git blame and
git shortlog -sn (commit counts) more accurate.
There are tools like hitch to help you commit as a pair, but I found it complex and buggy, and I’ve been happy with something simpler.
I just added some simple aliases to my Bash shell:
1 2 3 4 5
pair tells me who I’m committing as.
pairf will pair me up with Foo Fooson;
pairb will pair me up with Bar Barson.
unpair will unpair me.
All this is done via Git’s own persistent per-repository configuration.
The emails use plus addressing, supported by Gmail and some others:
email@example.com ends up at
I recommend consistently putting the names in alphabetical order so the same pair is always represented the same way.
If you’re quite promiscuous in your pairing, perhaps in a large team, the aliases will add up, and you may prefer something like hitch. But in a small team like ours, it’s not an issue.
A killer feature of my solution, that doesn’t seem built into hitch or other tools, is that it’s easy to show in your prompt:
1 2 3 4 5
This will give you a prompt like
~/myproject (pair: FF+HN)$ when paired, or
GitHub looks better if pairs have a user picture.
You just need to add a Gravatar for the pair’s email address.
When we started committing as pairs, I toyed a little with generating pair images automatically. When Thoughtbot wrote about pair avatars yesterday, I was inspired to ship something.
Try it out!