Created
January 7, 2015 19:00
-
-
Save toast38coza/890ad14bea5e0d47cf14 to your computer and use it in GitHub Desktop.
Require that git commit messages contain a Pivotal ID
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| import re, sys | |
| message_file = sys.argv[1] | |
| f = open(message_file) | |
| message = f.read() | |
| p = re.compile('^\[\#\d+\]') | |
| if p.match(message) is None: | |
| print "This commit needs a pivotal story ID. e.g.: git commit -am'[#82695812] - message goes here .. ' where 82695812 is your pivotal story ID" | |
| sys.exit(1) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Simply put this file in
.git/hooks/prepare-commit-msgand then, if you try make a commit without including your Pivotal Tracker story ID you will get an error message.