Skip to content

Instantly share code, notes, and snippets.

@zwilias
Created December 29, 2016 18:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zwilias/7127c8e082602f90f0ec6c0a830ac3d0 to your computer and use it in GitHub Desktop.
Save zwilias/7127c8e082602f90f0ec6c0a830ac3d0 to your computer and use it in GitHub Desktop.
# Create the directory and make sure
mkdir -p ~/.git-template/hooks
# Create a post-commit file in that directory and feed it the commit-hook:
cat > ~/.git-template/hooks/post-commit << EOF
#!/usr/bin/env ruby
file="~/.gitshots/#{Time.now.to_i}.jpg"
unless File.directory?(File.expand_path("../../rebase-merge", __FILE__))
puts "Taking capture into #{file}!"
system "imagesnap -q -w 3 #{file} &"
end
exit 0
EOF
# Make it executable
chmod o+x ~/.git-template/hooks/post-commit
# Finally, "activate" your init dir
git config --global init.templatedir '~/.git_template'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment