Last active
December 31, 2015 14:18
-
-
Save zilongshanren/7998884 to your computer and use it in GitHub Desktop.
force adding (issue #digit or fixed #digit) into commit message
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 | |
message_file = ARGV[0] | |
message = File.read(message_file) | |
#starts with # then number, space, and at least 5 words no more than 200 | |
$regex = /(fixed #(\d+)|issue #(\d+))/ | |
if !$regex.match(message) | |
puts "Please add issue #digit or fixed #digit to your commit msg" | |
exit 1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://www.launchacademy.com/blog/posts/automatically-prevent-some-bad-git-commits#.Uq9-CH8ayK0