git commit -am "[Story467593 state:finished] My super duper comment."
Story 467593 on Pivotal Tracker is now marked finished, and has “My super duper comment”. Your git commit has been tied to Pivotal Tracker just like that.
Use this project so that commit messages pushed to your non-github git server automatically post as comments tied to your Pivotal Tracker stories, and can also change the state of those stories.
This is very handy way to tie your git history to your Pivotal Tracker history.
If your project lives on github, use tracker-github-hooks. If you use Lighthouse, then use lighthouse-git-hooks instead. Those projects inspired this one, and in all honesty, this project is as much a fork of lighthouse-git-hooks as not.
If you want to use this, and desire functionality not yet in place, then fork away! It is open source, after all.
Installation and Configuration
Install tracker-git-hook (One Time Only)
- log into your git server, probably as the git user, in git’s home directory
- If you use Ubuntu, you must have libxml2-dev and libxslt1-dev packages installed (for nokogiri)
sudo gem install hpricot mime-types archive-tar-minitar nokogiri hoe rcov diff-lcs(sorry for the giant list o’ dependencies!)
git clone git://github.com/bendycode/tracker-git-hook.git
git submodule init
git submodule update
Configure a project
- cd into your project’s hook directory
- For me, this was in ~git/repositories/project_name/hooks
- It might also be in ~git/repositories/project_name/.git/hooks
mv post-receive post-receive.original
cp $TRACKER_GIT_HOOK_HOME/hooks/post-receive.sample ./post-receive
- Your file must be executable at this point.
- edit the new copy of post-receive:
- set TRACKER_GIT_HOOK_HOME to the same directory you set it to when installing tracker-git-hook above.
- set your PROJECT_NAME
cp -r sample your_project_name
- edit your new project config directory.
- Note that I have set .gitignore to keep your (and my) project config settings out of github.
- copy login\@example.com for each of your users & edit as appropriate
Try it out
- Try the syntax shown above, but for a story number in your project.
- If everything worked, then party! You’re good to go.
- If there are errors, then:
- Don’t panic. They occur in the POST-receive hook, so your git commit still worked. This project will not mess up your commits.
- Calmly read the error messages. There should be line numbers from the post-receive hook.
- Figure out the answer, fix it, and send me a README enhancement, or a patch, so this will be better for the next person (perhaps you, on your next project!)
- Once this is in place, and working, then you can simply enjoy having your git commits tied to Pivotal Tracker. W00t!
© 2009 bendycode
© 2008 Antonin Amand (author of lighthouse git hooks that this is forked from)