Skip to content

Instantly share code, notes, and snippets.

@cdcabrera
Last active August 29, 2015 14:05
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 cdcabrera/fa8cde5f6bc6d434766b to your computer and use it in GitHub Desktop.
Save cdcabrera/fa8cde5f6bc6d434766b to your computer and use it in GitHub Desktop.
GitShots, take a snapshot when you commit.
#!/bin/bash
#
# Where I pulled this from: https://gist.github.com/jellea/3438926
#
# This script will make a webcam snapshot every commit. The jpg file will have
# the commit id as the filename.
#
# This script requires imagesnap. Install with: 'brew install imagesnap'
#
# Put this file in the '.git/hooks/' name it 'post-commit' and chmod it by:
# 'chmod +x .git/hooks/post-commit’
#
# If that doesn't work try the below, otherwise it'll interfere with the GitHub gui sync/push
# 'chmod 777 .git/hooks/post-commit'
#
#
# Inspired by Victor Martinez (http://coderwall.com/p/xlatfq?p=1&q=)
# Creates the .gitshots directory if it doesn’t exist
# The '&' helps prevent lag
#
#
PATH="/usr/local/bin:$PATH"
mkdir -p .gitshots
COMMITID=$(git rev-parse HEAD)
TIMESTAMP=$(date +"%Y%m%d-%H%M%S-")
imagesnap -q -w 1 .gitshots/$TIMESTAMP$COMMITID.jpg &
#!/bin/bash
#
# Where I pulled this from: https://gist.github.com/jellea/3438926
#
# This script will make a webcam snapshot every commit. The jpg file will have
# the commit id as the filename.
#
# This script requires imagesnap. Install with: 'brew install imagesnap'
#
# Put this file in the '.git/hooks/' name it 'pre-commit' and chmod it by:
# 'chmod +x .git/hooks/pre-commit’
#
# If that doesn't work try the below, otherwise it'll interfere with the GitHub gui sync/push
# 'chmod 777 .git/hooks/pre-commit'
#
#
# Inspired by Victor Martinez (http://coderwall.com/p/xlatfq?p=1&q=)
# Creates the .gitshots directory if it doesn’t exist
# The '&' helps prevent lag
#
#
PATH="/usr/local/bin:$PATH"
mkdir -p .gitshots
COMMITID=$(git rev-parse HEAD)
TIMESTAMP=$(date +"%Y%m%d-%H%M%S-")
imagesnap -q -w 1 .gitshots/$TIMESTAMP$COMMITID.jpg &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment