Setting the Commit Author to Pair Programmers’ Names in Git

[Authored by Sam]

In beezwax’s webdev division we generally work in pairs, but our commit logs didn’t used to show this. We wouldn’t bother to reconfigure the git author every time we sat down with a new pair so our git log only recorded one of the programmers’ names. Bryan Helmcamp has a nice script for setting your git commit author in pair programming situations. Here’s another one which works interactively.

Interactively set the git commit author to pair programmers’ names:

Now when you’re ready to commit you’ll be asked if this is a paired programming session.

Hitting return will run the commit as you alone, but if you enter a number your commits can look like this:

It requires no extra effort (ok 1 keystroke), and works great if you don’t want to run a bunch of git config commands each time you’re ready to commit.

Leave a Reply