Git pairing aliases, prompts and avatars

Written . Tagged Git.

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:

alias pair='echo "Committing as: `git config` <`git config`>"'
alias unpair="git config --remove-section user 2> /dev/null; echo Unpaired.; pair"

alias pairf="git config user.pair 'FF+HN' && git config 'Foo Fooson and Henrik Nyh' && git config ''; pair"
alias pairb="git config user.pair 'BB+HN' && git config 'Bar Barson and Henrik Nyh' && git config ''; pair"

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: 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:

function __git_prompt {
  [ `git config user.pair` ] && echo " (pair: `git config user.pair`)"

PS1="\W\$(__git_prompt)$ "

This will give you a prompt like ~/myproject (pair: FF+HN)$ when paired, or ~/myproject$ otherwise.


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.

So I released Pairicon, a tiny open source web app that uses the GitHub API and a free Cloudinary plan to generate pair avatars.

Try it out!