Skip to content

Instantly share code, notes, and snippets.

@jbgo
Created February 23, 2012 19:16
Show Gist options
  • Save jbgo/1894447 to your computer and use it in GitHub Desktop.
Save jbgo/1894447 to your computer and use it in GitHub Desktop.
Git hook to require a PT story# in your commit message
#!/usr/bin/env ruby
unless File.new(ARGV.first).read =~ /\[#\d+/
puts "Commit aborted! Missing reference to Pivotal Tracker story in commit message. (e.g. [#12345])"
exit 1
end
cd ~/your/project
curl https://raw.github.com/gist/1894447/5a3d055690916cd4dadc6be0aec7881242e15c33/commit-msg > .git/hooks/commit-msg
chmod +x .git/hooks/commit-msg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment