Reno, NV    +1 (800)0 621-0871

Go back

Tutorial

A Git Trick for Pivotal Users

  |  September 20, 2011

I always keep forgetting the pivotal ticket number of the bug/feature I am working on(who doesn’t?) What I usually do is to alt-tab to my Pivotal Dashboard, look at the ticket number, copy it, then paste on my commit message.

Pretty tiring for a ‘lazy programmer’. So, since we’re all lazy, I found a way to get the ticket number faster than you can type “woot!”. Actually, this only works when you’re committing multiple times to a single ticket(which we usually do).

I basically just do a git log, look at my most recent commit and copy the ticket number from there:

[#15757415] fixed fonts and restructured blog sidebar to make it more DRY

Now take another step back and being lazier, I bound a command to an alias so I can peek at that log by just typing three letters. So of we go to edit .bash_profile and add this line:

alias 'git log --oneline | head -1'

Tada. If you’re THAT lazy, you can even add a grep and throw in a pbcopy so all you need to do is paste it. But I like to double check that the ticket number I’m copying is the correct one, so no pbcopy for me.