Skip to content

Instantly share code, notes, and snippets.

@eccyan
Created March 31, 2014 03:26
Show Gist options
  • Save eccyan/9884704 to your computer and use it in GitHub Desktop.
Save eccyan/9884704 to your computer and use it in GitHub Desktop.
prepare-commit-msg for JIRA
#!/usr/bin/env ruby
exit if %w(merge).include? $*[1]
current_branch = `git rev-parse --abbrev-ref HEAD`
if /^([A-Z]{2,}-\d+).*/ =~ current_branch
commit_messages = File.readlines($*[0])
open($*[0], 'w') do |file|
commit_messages.unshift "#{$1} " << commit_messages.shift
file.puts commit_messages
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment