Skip to content

Instantly share code, notes, and snippets.

@lastk
Forked from dce/gist:44754
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lastk/c4d4877b824dc9a6338c to your computer and use it in GitHub Desktop.
Save lastk/c4d4877b824dc9a6338c to your computer and use it in GitHub Desktop.
simple git commit hook
#!/usr/bin/ruby
require 'rubygems'
require 'git'
log = "~/gitlog.txt"
tmp = "/tmp/gitlog"
commit = Git.open('.').log.first
message = [
commit.date.strftime('%D'),
`pwd`.split(/\//).last.strip,
commit.message
] * "\t"
`touch #{log} && echo "#{message}" | cat - #{log} > #{tmp} && mv #{tmp} #{log}`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment