Skip to content

Instantly share code, notes, and snippets.

@mribica
Created December 15, 2012 17:53
Show Gist options
  • Save mribica/4297623 to your computer and use it in GitHub Desktop.
Save mribica/4297623 to your computer and use it in GitHub Desktop.
Gitshot post-commit hook (OS X)
#!/usr/bin/env ruby
puts "[Cheese!]"
# Get some info about current commit
repository_name = `basename "$PWD"`.chop
commit_hash, commit_date = `git log -1 --pretty="%H%n%ci"`.split(/\r?\n/)
# Capture image and save it to ~/Pictures/gitshots/REPOSITORYNAME-TIMESTAMP-COMMITHASH.jpeg
exec "imagesnap ~/Pictures/gitshots/#{repository_name}_#{commit_date.gsub!(' ', '_')}_#{commit_hash}.jpeg"
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment