Created
June 1, 2012 15:12
-
-
Save stecb/2852850 to your computer and use it in GitHub Desktop.
Hook post-commit to get a snapshot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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