Skip to content

Instantly share code, notes, and snippets.

@Slowhand0309
Created October 24, 2015 09:14
Show Gist options
  • Save Slowhand0309/2479224835c16a81de89 to your computer and use it in GitHub Desktop.
Save Slowhand0309/2479224835c16a81de89 to your computer and use it in GitHub Desktop.
git-hooks update for print info by push
#!/usr/bin/env ruby
refname = ARGV[0]
oldrev = ARGV[1]
newrev = ARGV[2]
puts "push info >> \n(#{refname}) (#{oldrev[0,6]}) (#{newrev[0,6]})"
sharevs = `git rev-list #{oldrev[0,6]}..#{newrev[0,6]}`.split("\n")
sharevs.each do |rev|
message = `git cat-file commit #{rev} | sed '1,/^$/d'`
committer = "?"
messages = `git cat-file commit #{rev}`.split("\n")
messages.each do |msg|
committer = msg if msg.include?("committer")
end
puts committer
puts message
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment