Take a Picture Of Yourself On Every Git Commit – The Git Commit Movie


I am always trying to connect programming to film & media in any way I can, so what better way than to take a picture of myself with my laptop’s webcam every time I commit some code.

Using a couple commands in terminal and a basic script,  you can automate the process, so all you have to do is sit back, commit some code and be photogenic.

In this tutorial, I have compiled the best of other tutorials, gotchas, and related content I have come across on the web. At the end of this, you can even star you in your own git commit movie.

Getting Started

Just a heads up, this is geared towards OSX users… for everyone else, I will add more details when I come across Linux, Windows info ūüôā

Step 1: Install imagesnap

brew install imagesnap

Step 2: Create post-commit hook

Add the following code from the gist below to a file called ¬†post-commit in your repo’s ~/.git/hooks/ folder.


Step 3: Enable permissions

Lets give the file some permission (making it executable by everyone).

sudo chmod +x ~/.git/hooks/post-commit

Step 4: Start committing and smiling 

On first run, the script will create a folder called commit_images in your repo’s root. Then every time you commit code, a photo is added to the folder and to .gitignore automatically so you don’t have to.

Current Downfall

The only downfall to this solution is you have to add it to each of your git repos manually. So if you have a lot of repos it might be a pain, but then again thats what writing a script is for, right? So behold…the global solution (for new repos)!

Global Solution

1. Enable git templates. This will copy everything in the .git-templates folder to any new git repositories when you git init

 git config --global init.templatedir '~/.git-templates'

2. Create our hooks folder for the post-commit template.

mkdir -p ~/.git-templates/hooks

3. Add the post-commit file in ~/.git-templates/hooks/. We can use the same script from above in step 2.

4. Make our post-commit executable. We are giving it executable permission to all users in this case.

sudo chmod +x ~/.git-templates/hooks/post-commit

5. Start committing and smiling. Every time we  git init, we now have the post-commit hook in all of our new repos.

Nice to Have

Here are some things I am looking into:

  • Store pictures from all repos into one folder instead of in each individual repo. eg. in ~/.commit_images
  • More to come…

Stitching It All Together (Movie Time)

More details in the link, but we can essentially use ffmpeg to create a short stop motion video of our commit images.


Final Product (The Movie)

I am planning on adding my own video when I amass some pictures, but in the mean time here is a short video sample.


Special Thanks

  • V√≠ctor Mart√≠nez¬†–¬†https://coderwall.com/p/xlatfq¬†(original idea)
  • Damon Davison¬†–¬†https://coderwall.com/p/l3kwta (bash script)
  • Matt Venables¬†–¬†https://coderwall.com/p/jp7d5q (global solution)
  • Lolcommits –¬†http://mroth.github.io/lolcommits/

Moving on to OSX Mountain Lion – Three don’t I don’t like about 10.8.3

Moving on to Mountain Lion from Snow Leopard was probably the best thing I could have done for my early 2009 White Macbook. I have been using it to program for over 4 years now and I could not have been happier with it. It might only have 4 GB of RAM and a 2.13 ghz Core 2 Duo but it still runs like a beast. The only downside was I was running out of hard drive space and in result the crippling OS performance. If you want to see some tips to making your Mountain Lion install feel like the previous versions, skip ahead to the bottom.

Getting a new hard drive 

First thing I did was buy a new  1TB Samsung Spinpoint M8. Replacing the old 120GB hard drive has been long overdue. It was between the Samsung, a 7200RPM 750GB Seagate Momentus, or a WD 7200RPM 750GB Scropio Black. After looking at some reviews on stroragereview, I was convinced the extra 250GB and longer battery life was worth the Samsung M8. Skip ahead a couple days and I got the Samsung installed in my Macbook.

Upgrading to Mountain Lion

The only thing stopping me from upgrading in the past, was the amount of space left on my hard drive. So with almost unlimited space left, the next logical step was to upgrade to Mountain Lion. Before buying my copy, I put in my laptop serial number here (to see if it is a supported model) and compared it to the minimum requirements for installing Mountain Lion here. Looks like I met the requirements. Now I fired up the app store, found the Mountain Lion update and let it fire.

Three things I didn’t like about Mountain Lion¬†

1. Reversed Scrolling

The scrolling is reversed to make it feel like natural iPhone and iPad scrolling. To fix this, go to System Preferences > Trackpad/Mouse, and uncheck the ‘When using gestures to scroll or navigate, ¬†move content…’. Reversed scrolling begone!

Disable natural scrolling

2. New Finder window opens up¬†‘All My Files’

Again something new for me in Mountain Lion. This new ‘All My Files’ takes a long time to load and lags the finder. Just like in the Snow Leopard I like to have it open up to a custom folder. You can do so by going to Finder > Preferences (CMD + ,). Then under ‘New Finder Window show’ change it to your liking.

New Finder Window

3. Drive Status in Finder

Every drive use to have a status at the bottom of the Finder window. The status included the number of items and size remaining of the drive. It is incredibly when using external USB devices so you can see how many more items you can cram on the device before you run out of space. This can be fixed easily. Once you have Finder open, go to View > Show Status Bar (or press CMD + /)

Finder enable status

Finder Status