Created
October 29, 2014 13:53
-
-
Save ykyk1218/67ed2f542b092c53edb0 to your computer and use it in GitHub Desktop.
Gitでcommitした時にブランチ名をcommitメッセージに自動でいれる ref: http://qiita.com/ykyk1218/items/4c17eef472ae8c31991f
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
$ vi .git/hook/prepare-commit-msg |
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 | |
#今いるブランチ名を取得 | |
current_branch = `git branch | grep '*'`.chomp.sub('* ', '') | |
commit_msgs = File.readlines(ARGV[0]) | |
open(ARGV[0], 'w') {|file| | |
file.print "#{current_branch}:" | |
file.puts commit_msgs | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment