Skip to content

Instantly share code, notes, and snippets.

@lingceng
Created April 1, 2016 09:22
Show Gist options
  • Save lingceng/50ba52cad80f47780a1e898fae1d91a1 to your computer and use it in GitHub Desktop.
Save lingceng/50ba52cad80f47780a1e898fae1d91a1 to your computer and use it in GitHub Desktop.
Add recent logs to commit message. Put file at .git/hooks/prepare-commit-msg
#!/usr/bin/env ruby
template = ARGV[0]
File.open(template, "a") do |file|
logs = `git log -n 10 --oneline`
logs = logs.each_line.map { |line| '# ' + line }.join()
file.puts logs
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment