Created
January 20, 2015 19:20
-
-
Save bitops/83eb116ca34154e451a2 to your computer and use it in GitHub Desktop.
A git commit hook in Ruby for appending the name of the current branch to the commit message
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/ruby | |
| COMMIT_FILE = File.expand_path(ARGV[0]) | |
| current_branch=`git branch | grep '*' | awk '{print $2}'` | |
| commit_msg = File.read(COMMIT_FILE) | |
| current_branch << commit_msg | |
| File.open(COMMIT_FILE, 'w') {|f| f << current_branch} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment