Skip to content

Instantly share code, notes, and snippets.

@mislav

mislav/post-commit.sh

Last active Dec 11, 2015
Embed
What would you like to do?
git post-commit hook to snap an image of you from the webcam
#!/bin/bash
# git post-commit hook to snap an image of your smiling face.
set -e
[ -n "$GIT_DIR" ] && cd "${GIT_DIR}/.."
image_dir="commit_images"
image_file="${image_dir}/${USER} $(date '+%Y-%m-%d at %H.%M.%S').jpg"
grep "$image_dir" .gitignore &>/dev/null || echo "${image_dir}" >> .gitignore
mkdir -p "$(dirname "$image_file")"
imagesnap -q "$image_file"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment