Created
April 1, 2016 09:22
-
-
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
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 | |
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