Coder Social home page Coder Social logo

git-pivotal-hooks's Introduction

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.

git-pivotal-hooks's People

Contributors

daniellesucher avatar npetrell avatar riskx avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.