-
-
Save ignasi/7346872 to your computer and use it in GitHub Desktop.
Take a photo of you, whenever you make a commit
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 | |
############# | |
# This is my fork of consti/post-commit gist: https://gist.github.com/consti/3082406 | |
# It uses a more human date naming and stores captures from same repo to same directory. | |
# I have also added branch name at filename. | |
############# | |
# | |
# Take a photo of you, whenever you make a commit | |
# | |
# This is an improved version of Víctor Martínez original post: | |
# http://coderwall.com/p/xlatfq | |
# | |
# Improvements: | |
# * This is non-blocking (you dont have to wait for your image to be taken) | |
# * It's plug-and-play (and creates the required folder) | |
# * We include the repository name (or the folder name of the repository to be exact) | |
# * It's not requiring ruby to run (it just uses bash) | |
# | |
# | |
# > brew install imagesnap | |
# Save this file as ~/.git_template/hooks/post-commit | |
# then do: | |
# > chmod +x ~/.git_template/hooks/post-commit | |
# > git config --global init.templatedir '~/.git_template' | |
# | |
# this will add the post-commit to all new repositories. | |
# To add to an existing one, run | |
# > git init | |
# in the repository. | |
# | |
# Want to create a cool video? Use this to assemble the pictures: | |
# http://www.dayofthenewdan.com/projects/tlassemble | |
forked_image() { | |
repo_name=$(basename $PWD) | |
repo_dir=~/.git_shots/$repo_name | |
branch_name=`git rev-parse --abbrev-ref HEAD` | |
mkdir -p $repo_dir | |
imagesnap -q -w 3 $repo_dir/$(date +%Y.%m.%d_%H.%M.%S)\_$repo_name\_$branch_name.jpg & | |
} | |
forked_image & |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Put the
post-commit
file in your/usr/share/git-core/templates/hooks
folder and every git repo you create or clone in the future will have the hook :D