Created
January 29, 2013 10:15
-
-
Save s6577t/4663236 to your computer and use it in GitHub Desktop.
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/env ruby | |
| # | |
| # An example hook script to check the commit log message. | |
| # Called by "git commit" with one argument, the name of the file | |
| # that has the commit message. The hook should exit with non-zero | |
| # status after issuing an appropriate message if it wants to stop the | |
| # commit. The hook is allowed to edit the commit message file. | |
| # | |
| commit_msg = File.read(ARGV[0]) | |
| unless /\A\[#\d+\].*/m.match(commit_msg) | |
| puts 'Commit message rejected by commit-msg git hook because it does not start with a story id. Valid example: "[#123456789] make it so"' | |
| exit -1 | |
| end |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
put this in .git/hooks/ in a file called commit-msg, which will need execute permissions.