Pair programming is like flying F-14s, and not just because our profession enjoys the same rock star status. Just like Maverick and Goose, one dev flies, and one is pretty much the Radar Intercept Officer, having a more dedicated view of threats including syntax errors and stray whitespace.

But just like there are two names on those Top Gun plaques, there are two devs in a pair, so there shouldn’t there be two names on the Git commit? After all “We happened to see a MiG 28 do a 4g negative dive.”

Going steady with your pair? Time to get hitched

Hitch from Rogelio J. Samour, Ruby hacker, bass player, Vim aficionado, and Solutions Barista at Hashrocket has created an easy way to assign multiple author attribution for your Git commits. Hitch creates a unique pair from Git users and even persists those pairs between terminal sessions. Pairs can even have their own fancy Gravatar for sites that support it (like GitHub).

Begin by installing the Ruby gem:

gem install hitch

RVM users will need to install the Hitch gem across all of their gemsets by running:

for x in $(rvm list strings); do rvm use $x@global && gem install hitch; done

Finally, Hitch needs some aliases in your Bash or Zsh profile:

hitch --setup >> ~/.bashrc

or

hitch --setup >> ~/.zshrc

You can then ‘hitch’ users together with hitch

$ hitch pengwynn adamstac

I don't know who pengwynn is.
Do you want to add pengwynn to ~/.hitch_pairs?
$ y

What is pengwynn's full name?

$ Wynn Netherland
I don't know who adamstac is.

$ y
What is adamstac's full name?

$ Adam Stacoviak
What is the group email? e.g. dev@hashrocket.com will become dev+therubymug+leshill@hashrocket.com

$ ping@thechangelog.com
Adam Stacoviak and Wynn Netherland <ping+adamstac+pengwynn@thechangelog.com>

This ‘new’ email address still gets routed to the same ‘ping’ address in gmail, so no new email setup needed. Now we can set up this new email address on Gravatar:

email screen cap

There you have it. What tools do you use in your pair programming workflow? Let us know, we’d love to share them with our readers.

Check out the source on GitHub.


Have comments? Send a tweet to @TheChangelog on Twitter.

Subscribe to The Changelog Weekly – our weekly email covering everything that hits our open source radar.