Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Git commit scripts that can be used with pivotal tracker

branch: master

This branch is 0 commits ahead and 0 commits behind master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 .gitignore
Octocat-spinner-32 .pivrc.sample
Octocat-spinner-32 README.md
Octocat-spinner-32 gitpiv-setup.sh
Octocat-spinner-32 prepare-commit-msg.sample.py
README.md

This script creates a prepare-commit-msg hook for git. Whenever you commit, it connects to Pivotal Tracker, gets all the stories you own on the given project, and adds the story number(s) to your commit message. With GitHub's Pivotal post-receive hook set up, that will add a link to each commit to the relevant story on Pivotal whenever you push to GitHub.

Global setup

Clone this repository somewhere. Hypothetically, let's say you stuck it in "~/code/git-pivotal-hooks".

Make the setup script executable:

chmod a+x gitpiv-setup.sh

Add the following to your .bashrc (replacing the path with the actual path to your clone of this repository, of course):

alias gitpiv=". ~/code/git-pivotal-hooks/gitpiv-setup.sh"

Great! Now whenever you have a local project you want to link to a Pivotal Tracker project, you can set it up as follows:

Project setup

Make sure your current project is set up with git already. Then in the main directory of your current project, just run

gitpiv

That will copy the appropriate prepare-commit-msg hook to your local .git hooks directory and make it executable for you. It'll also copy a file called .pivrc.sample to your main project directory, and add .pivrc to your local .gitignore, since that's where you're about to put your Pivotal API token.

Edit .pivrc.sample by filling in your Pivotal API token, project ID #, and initials (or whatever Pivotal uses to identify you on stories, I suppose) (or whatever other filter(s) you prefer - but remember, spacing matters!), then rename the file:

mv .pivrc.sample .pivrc

Now you can go to the admin settings for your GitHub repository and set up GitHub's Pivotal Tracker post-receive hook by putting in your same Pivotal API.

That's it, you're good to go! Whenever you make a commit in that project, you'll get a list of all of your Pivotal stories, and the chance to choose which one(s) to add to your commit message so that the links to that commit will be added to the relevant Pivotal story/storieswhen you push to GitHub.

Major thanks to npetrell, whose active_stories.py provided the meat of the prepare-commit-msg here.

Something went wrong with that request. Please try again.