Skip to content

Instantly share code, notes, and snippets.

@bitops
Created January 20, 2015 19:20
Show Gist options
  • Select an option

  • Save bitops/83eb116ca34154e451a2 to your computer and use it in GitHub Desktop.

Select an option

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
#!/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