Created
September 7, 2016 00:23
-
-
Save carld/b42c8c15a88c2678b0b0efa55ad66067 to your computer and use it in GitHub Desktop.
pleasant lawyer git hook prepare-commit-msg, .git/hooks/prepare-commit-msg
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 | |
require 'pleasant_lawyer' | |
git_branch_name = `git symbolic-ref -q HEAD` | |
branch_name = File.basename(git_branch_name).gsub(/_/," ") | |
file = File.open(ARGV[0], 'r') | |
contents = file.read | |
file.close | |
File.open(ARGV[0], 'w') do |file| | |
file.write("B##{PleasantLawyer.convert(branch_name)} ") if branch_name.split(/ /).length == 2 | |
file.write(contents) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment