Close
Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

LABS
Did we git pair?

“Did we git pair” is something developers at pivotal are used to hearing shortly after committing and right before pushing. After reviewing the changes, one half of the pair usually takes over the keyboard to build the commit, something that lends itself to quick successive actions that follow on with little thought once you’ve mastered git.

While we pair all the time, git is just just one of the many tools (*cough* tracker *cough*) we use that that doesn’t understand pairing. Years ago we wrote a script to make setting the git author as easy as possible, and publish it as a chef recipe in pivotal_workstation and as a ruby gem.

Once the .pairs file is set up, git-pair gives us one command to run:

Matthews-MacBook-Air-3:pivotal_workstation (gemify) mk$ git pair mk bc
global: user.name Brian Cunnie & Matthew Kocher
global: user.email pair+cunnie+mkocher@pivotallabs.com
global: user.initials mk bc
Matthews-MacBook-Air-3:pivotal_workstation (gemify) mk bc$

Anyone reading especially closely will notice that we also put the current initials at the end of the bash prompt. (using another chef recipe)

If your pair wasn’t paying attention and didn’t remind you to git pair, you can ammend the the commit to fix it. However, git won’t rewrite the author by default, you’ll need to run `git commit –amend –reset-author`. The usual caveats about amending commits after pushing still apply.

Comments
  1. Alexander says:

    I went a step further and modified the prompt to display “(not paired!)” in red if there is no git pair set.

  2. Alexander says:

    I cut down on how many times we asked “were we paired?” by modifying the ps1 chef script to spit out “(not paired!)” in red if there are no pairs set.

    (Heads up, the link to the bash script recipe is broken)

  3. Rick Kawala says:

    I’ve written a test called GitPairTest on a couple of projects. In a sentence, it looks at the modification time for ~/.gitconfig (because we generally use git pair –global on Android projects, and that’s the file which gets changed). If it hasn’t been modified for 9 hours, the test fails. Since everyone runs tests before they check in (right?), this alerts you right when you need to be alerted.

Post a Comment

Your Information (Name required. Email address will not be displayed with comment.)

* Copy This Password *

* Type Or Paste Password Here *