Skip to content

Instantly share code, notes, and snippets.

@zilongshanren
Last active December 31, 2015 14:18
Show Gist options
  • Save zilongshanren/7998884 to your computer and use it in GitHub Desktop.
Save zilongshanren/7998884 to your computer and use it in GitHub Desktop.
force adding (issue #digit or fixed #digit) into commit message
#!/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
@zilongshanren
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment