• Stars
    star
    170
  • Rank 223,357 (Top 5 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 12 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Some simple tricks that make working with Pivotal Tracker even better... and easier... um, besier!

GitTracker

Gem Version Build Status Maintainability Test Coverage

GitTracker, or git-tracker, is a Git hook that will scan your current branch name looking for something it recognizes as a Pivotal Tracker story number. If it finds one, it will automagically add it, in the special format, to your commit message.

Installation

1) Install the git-tracker binary

You need to get the git-tracker binary onto your system.

  • via Homebrew 🍻 (preferred)

    $ brew install git-tracker
  • via RubyGems πŸ˜” (if you must)

    $ gem install git_tracker

2) Initialize the hook

Then you need to initialize the git hook into each local Git repository where you want to use it.

# from inside a local Git repository
# for example: /path/to/repo/
$ git tracker init

This will put the prepare-commit-msg hook in the /path/to/repo/.git/hooks directory and make it executable.

NOTE: The hook needs to be initialized just once for each repository in which you will use it.

Usage

With the hook initialized in a repository, create branches being sure to include the Pivotal Tracker story number in the branch name.

$ git checkout -b a_useful_and_helpful_name_8675309

When you commit, Git will fire the hook which will find the story number in the branch name and prepare your commit message so that it includes the story number in the special Pivotal Tracker syntax.

# on branch named `best_feature_ever-8675309`
$ git commit

Will result in a commit message something like: (notice the two empty lines at the top)

[#8675309]
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch best_feature_ever-8675309
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
# new file:   feature.rb
#

You should then add a useful and responsible commit message. ❀️

Passing commit messages via command line

If you pass a commit message on the command line the hook will still add the story number, preceded by an empty line, to the end of your message.

# on branch named `best_feature_ever-8675309`
$ git commit -m'Look at this rad code, yo!'

Results in this commit message:

Look at this rad code, yo!

[#8675309]

However, if you include the story number in the Pivotal Tracker format within your commit message, the hook will do nothing.

# on branch named `best_feature_ever-8675309`
$ git commit -m'[#8675309] Look at this rad code, yo!'

Results in this commit message:

[#8675309] Look at this rad code, yo!

Keywords

You can use the custom keywords that Pivotal Tracker provides with the API.

The keywords are fixed, completed, finished, and delivered in square brackets. You may also use different cases and forms of these verbs, such as Fix or FIXES.

If you use those keywords in your commit message, the keyword will be prepended to the story ID in the commit message.

For example:

# on branch named `bug/redis_connection_not_initializing_8675309`
$ git commit -am "Change the redis connection string [Fixes]"

Results in this commit message:

Change the redis connection string [Fixes]

[Fixes #8675309]

Valid branch names

GitTracker allows you to include the story number any where in the branch name, optionally prefixing it with a hash (#). Examples:

  • best_feature_ever_#8675309
  • best-feature-ever-8675309
  • 8675309_best_feature_ever
  • #8675309-best-feature-ever
  • your_name/8675309_best_feature_ever
  • your_name/#8675309_best_feature_ever

Contributing :octocat:

  1. Fork it
  2. Create your feature branch (git checkout -b my_new_feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my_new_feature)
  5. Create new Pull Request

More Repositories

1

console2-solarized

The Solarized theme ported to Console2
121
star
2

dumb_delegator

Delegator and SimpleDelegator in Ruby's stdlib are useful, but they pull in most of Kernel. This is not appropriate for many uses; for instance, delegation to Rails models.
Ruby
65
star
3

git-workflows

presentation: a handful of git workflows for the agilist
63
star
4

config

holy cow, wholly config! Vim, Zshell, Ack, & the rest of my dot-files.
Vim Script
20
star
5

tdd-bowling-game

An example of Test-Driven Development using Bowling as the domain.
JavaScript
8
star
6

lita-slack-karma-sync

Lita + Slack + Karma? You need to Sync!
Ruby
5
star
7

git-svn-import

a few scripts & tips I've used to migrate SVN repos to Git
Shell
4
star
8

raken

Rake tasks for building .NET code bases. (deprecated in favor of Albacore)
Ruby
4
star
9

cellar

Brewdega Cellar
Ruby
3
star
10

jquery-watermark

jQuery plugin adds watermark capability to HTML input elements
JavaScript
3
star
11

becomes

Allow an object to pose as an object of a different class.
Objective-C
2
star
12

statbox

a sample sports statistics application - I'm using it to explore/show Cucumber
Ruby
2
star
13

stevenharman.github.io

The website of me.
SCSS
1
star
14

scratchpad

where my random bits and bytes come to play
Ruby
1
star
15

buildtray

Automatically exported from code.google.com/p/buildtray
C#
1
star
16

stevenharman.net-octopress

The website of me.
JavaScript
1
star
17

editor-themes

my custom themes for various Windows editors.
Ruby
1
star
18

rocksalt

A .NET Assembly Manager Using RubyGems
Ruby
1
star
19

subtext-skins

custom skins for Subtext
ASP
1
star
20

superd

Super D, Inspiring the Peoples (with de-motivational posters)!
Ruby
1
star
21

statisticsbot

Keeping statistics' statistics straight
Ruby
1
star
22

osu-cis

A rediscovered archive of my time in the Computer Science & Engineering program at The Ohio State University (circa 1999-2004).
ASP
1
star