Skip to content

Instantly share code, notes, and snippets.

@stecb
Created June 1, 2012 15:12
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 stecb/2852850 to your computer and use it in GitHub Desktop.
Save stecb/2852850 to your computer and use it in GitHub Desktop.
Hook post-commit to get a snapshot
#!/bin/sh
# Put this in .git/hooks/post-commit (and chmod 755)
CUR_BRANCH=`git rev-parse --abbrev-ref HEAD`
# do this awesomeness if current branch is master
if [ "$CUR_BRANCH" == "master" ]; then
echo "Smile for the camera..."
MSG=`git log -1 --pretty=format:%s`
SNAPSHOT="last_commit.jpg"
# switch to gh-pages branch
git checkout gh-pages
# To take the snapshot use Snappy; download Snappy at https://github.com/pioz/snappy
snappy -d "FaceTime HD Camera (Built-in)" -m "$MSG" $SNAPSHOT
convert $SNAPSHOT -resize "800x800>" $SNAPSHOT
git commit -am "Add commit snapshot"
git push origin gh-pages
git checkout master
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment