xlatfq
Last Updated: August 14, 2018
·
101.5K
· knoopx

Take a photo of yourself every time you commit

Download imagesnap from https://github.com/alexwilliamsca/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>

30 Responses
Add your response

23

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} &"

over 1 year ago ·
563

"Taking capture into ~/.gitshots/1350594122.jpg!
Error."

Got this. Really have no idea :(. #newbie

over 1 year ago ·
915

@rebyn you have to make sure ~/.gitshots already exists. If not, issue a "mkdir ~/.gitshots" before commiting.

over 1 year ago ·
1019

@brunoassis Thank you. It works like a charm. I'm getting addicted to commits now.

over 1 year ago ·
1158

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

over 1 year ago ·
1243

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/

over 1 year ago ·
1263
over 1 year ago ·
1351

Mine didn't work until I did this:

chmod 777 .git/hooks/post-commit
over 1 year ago ·
2094

Or use my bash variant: https://gist.github.com/3438926

over 1 year ago ·
3178

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.

over 1 year ago ·
5712

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?

over 1 year ago ·
6326

@shoen That's up to you, of course.

over 1 year ago ·
6327

@shoen That's up to you, of course.

over 1 year ago ·
6369

@shoen it's silly, but it's fun and harmless. Could be good for team bonding :)

over 1 year ago ·
7598

Anyone familiar with SVN post-hooks? I'd like to set this up locally for an svn repo.

over 1 year ago ·
9836

I copied this idea and made a linux version: https://github.com/ashleyblackmore/beardsnapper

over 1 year ago ·
11695

This is pretty cool.

over 1 year ago ·
12038

This is so cool.

over 1 year ago ·
12584

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"?

over 1 year ago ·
12585

@konamax123 Git post-commit hook is at your-git-repo/.git/hooks/post-commit. Make sure you chmod +x it,

over 1 year ago ·
12586

@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?

over 1 year ago ·
12587

@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.

over 1 year ago ·
12849

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!

over 1 year ago ·
16807

awesome !!!

over 1 year ago ·
17776

great idea!

over 1 year ago ·
17918

nice!

over 1 year ago ·
24744

awesome

over 1 year ago ·
28188

The link is not available anymore :/

over 1 year ago ·
29094

Thanks for sharing

over 1 year ago ·
29517

Great trick

9 months ago ·