Created
July 15, 2011 08:28
-
-
Save aalin/1084318 to your computer and use it in GitHub Desktop.
git commit-msg hook that replaces STORYID with the story id from the branch name (s-123, s123, t123, t-123)
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 | |
| if match = `git symbolic-ref HEAD 2> /dev/null`.split('/').last.to_s.match(/^(?:t|s)-?(\d+)$/) | |
| message = File.read(ARGV.first) | |
| message.gsub!("STORYID", "[##{ match[1] }]") | |
| File.open(ARGV.first, 'w') do |f| | |
| f.puts(message) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment