Last active
October 16, 2015 14:28
-
-
Save aalin/6a5f1a8fceb12c2e39a8 to your computer and use it in GitHub Desktop.
Git hook for adding issue numbers to commits
This file contains 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 | |
filename = ARGV[0] | |
branch_name = `git rev-parse --abbrev-ref HEAD` | |
issue = branch_name[/^[A-Z]+-\d+/] | |
if issue | |
contents = File.read(filename) | |
File.write(filename, "#{ issue }:\n#{ contents }") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment