Last Updated: August 22, 2023
·
111.7K
· knoopx

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>

29 Responses
Add your response

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 ·

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

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

over 1 year ago ·

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

over 1 year ago ·

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

over 1 year ago ·

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 ·

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 ·
over 1 year ago ·

Mine didn't work until I did this:

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

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

over 1 year ago ·

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 ·

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 ·

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

over 1 year ago ·

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

over 1 year ago ·

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

over 1 year ago ·

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

over 1 year ago ·

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

over 1 year ago ·

This is pretty cool.

over 1 year ago ·

This is so cool.

over 1 year ago ·

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 ·

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

over 1 year ago ·

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

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

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 ·

great idea!

over 1 year ago ·

nice!

over 1 year ago ·

awesome

over 1 year ago ·

The link is not available anymore :/

over 1 year ago ·

Great trick

over 1 year ago ·

Nice!

over 1 year ago ·