Take a photo of yourself every time you commit
Download imagesnap from https://github.com/rharder/imagesnap or install it with homebrew:
brew install imagesnap
Create ~/.gitshots
directory:
mkdir ~/.gitshots
Add this as a post-commit hook to yout git repo:
#!/usr/bin/env ruby
file="~/.gitshots/#{Time.now.to_i}.jpg"
unless File.directory?(File.expand_path("../../rebase-merge", __FILE__))
puts "Taking capture into #{file}!"
system "imagesnap -q -w 3 #{file} &"
end
exit 0
Assemble the video with http://www.dayofthenewdan.com/projects/tlassemble
Enjoy!
<iframe src="http://player.vimeo.com/video/44067957" width="500" height="375" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
<a href="http://vimeo.com/44067957">Demo on Vimeo</a>.</p>
Written by Víctor Martínez
Related protips
29 Responses
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/13006/Photo_on_08.01.2013_at_04.15.jpg)
You can also add an ampersand to system command. It prevents lag after each commit, so you don't have to wait for camera to take a picture: system "imagesnap -q -w 3 #{file} &"
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/43738/3.jpg)
"Taking capture into ~/.gitshots/1350594122.jpg!
Error."
Got this. Really have no idea :(. #newbie
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/32853/b0366e26e202332ad265ea3f6e259f55.jpeg)
@rebyn you have to make sure ~/.gitshots already exists. If not, issue a "mkdir ~/.gitshots" before commiting.
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/43738/3.jpg)
@brunoassis Thank you. It works like a charm. I'm getting addicted to commits now.
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/46215/c630f26c1d202baa5af6bde5b7eeb8bb.png)
On linux replace "imagesnap -q -w 3 #{file} &" with "fswebcam #{file} &" and assemble the video with http://www.itforeveryone.co.uk/image-to-video.html
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/1514/d1d602879470aa96563c6ed345121d59.jpeg)
For what it's worth, I have a similar project pre-packaged as a rubygem with a CLI enable/disable for repos:
http://mroth.github.com/lolcommits/
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/24347/fc3bc471d76939fd21a8adf12fcd34da.png)
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/36688/60e85e0d1c0d115fdce4c1ecf33bc79c.jpeg)
Mine didn't work until I did this:
chmod 777 .git/hooks/post-commit
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/28067/blackbeard-pirate-movie_crop.jpeg)
Or use my bash variant: https://gist.github.com/3438926
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/53194/3e0b5461e0e5c733af00292ec2d15c83.png)
Now how do we get these images to show up in the github commits when we push?
Just to prove I wasn't drunk when I made that patch.
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/65348/30d7d4c13abcce7567310133134b829c.jpeg)
I can't understand what's the point of this? What do you want to achieve by posting a photo of yourself after each commit? Who is going to watch them and what is the message you/your commit photo is trying to broadcast to a user/visitor?
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/67642/47e7831147948fdc5cf46abe4c88a235.jpeg)
@shoen That's up to you, of course.
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/67642/47e7831147948fdc5cf46abe4c88a235.jpeg)
@shoen That's up to you, of course.
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/33560/0e2e822d32a7ab3d7f0b7098d03b1d16.png)
@shoen it's silly, but it's fun and harmless. Could be good for team bonding :)
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/47864/2013-05-19_17.29.51-1.jpg)
Anyone familiar with SVN post-hooks? I'd like to set this up locally for an svn repo.
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/39116/2a25a00e186906cd06947ce403e8c0d2.png)
I copied this idea and made a linux version: https://github.com/ashleyblackmore/beardsnapper
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/82318/avatar.jpg)
This is pretty cool.
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/81513/0fbb3826166cbd58fb8c3f44a021d511.png)
This is so cool.
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/96900/12cad0fa676a4668fb4fed8587cd6e06.jpeg)
Sorry for the newb question but what is a post-commit and where do I put the text that it says to add as a "post-commit hook to your git repo"?
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/24968/ecc4d502278ae77354564beb97bdff10.jpeg)
@konamax123 Git post-commit hook is at your-git-repo/.git/hooks/post-commit
. Make sure you chmod +x
it,
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/96900/12cad0fa676a4668fb4fed8587cd6e06.jpeg)
@knoopx, so I see my hooks directory but inside I don't have a file called post-commit. Is this a file that I create? Is this a .txt file?
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/24968/ecc4d502278ae77354564beb97bdff10.jpeg)
@konamax123 yes you need to create it and make it executable chmod +x your-git-repo/.git/hooks/post-commit
. The content of the file is the ruby code posted on the protip.
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/98566/fef2d4be2097d10e2fbe652dd1c71ea5.png)
Fun! This is a great idea to take a snapshot, but you could also imagine doing some other fun things like grabbing the weather or the currently playing song, etc.
Thanks for sharing!
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/123455/none.jpg)
great idea!
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/124500/Screen_Shot_2014-11-20_at_9.32.15_pm.png)
nice!
awesome
The link is not available anymore :/
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/198606/grayscale.jpg)
Great trick
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/2221343/soazelftester.jpg)
Nice!