Skip to Content Collective Idea Home

Happy Git Commits

by Brandon Keepers

It’s a given: being happy makes us more productive.

A few weeks ago while pairing, we decided that choirs should sing and crowds should cheer whenever we commit. I now have this in .git/hooks/post-commit for the projects that I work on most often:

#!/bin/sh

afplay ~/.git/happykids.wav > /dev/null 2>&1 &

Here is the sound file it plays.

I giggle every time I commit. It makes me want to start on the next bit of code so I can commit again.

Our friends at Ordered List use happy passwords. What are some of the ways you add happiness to your day?

Comments

Brandon Keepers
::

If anyone knows how to set up a global post-commit hook, please share.  I have to symlink this into every project for now.


John Nunemaker
::

Awesome. I like the idea of crowds clapping.


Tim Novinger
::

This is genius. + 400 happy geek points. :)


Brian Ryckbost
::

I’ll be honest, at first I thought it was somewhat lame. But after watching you commit, it made me chuckle.

Wish we could setup noises for other hooks though.


Bumi
::

hehe, very nice. ;) As far as I know there are no global hooks in git, but git copies the hook files from a global directory, so if you add your file there it should get copied to every new/cloned repository. On my installation the hook directory is: /usr/local/git/share/git-core/templates/hooks

We’ve used that while playing with: http://github.com/bumi/commit\_hookr


Marshall Huss
::

Love it, I went with a nice golf clap


Benjamin Meyer
::

@Brandon Keepers: I have written a git tool called git-hooks which lets you manage project, user and global hooks.  This way you don’t have to have copy hooks all over the place.

http://benjamin-meyer.blogspot.com/2010/06/managing-project-user-and-global-git.html


Matt Darby
::

Oh, I quite like that.


zack
::

On successful deploy - http://gist.github.com/508218


christian
::

I find your Gravatar animations very happy. :-)


Carlo
::

cp .git/hooks/post-commit.sample .git/hooks/post-commit echo “afplay ~/.git/happykids.wav > /dev/null 2>&1 &” >> .git/hooks/post-commit


Kyle Mathews
::

It’d be cool to if the office loudspeakers would play something every time code was rolled into the master branch.


Tomer
::

I actually added a SAY command to “git commit” and “git pull”, so people around me would know what to do next: Git Push ends with “say pull! pull like the wind!” Git Commit is just a stupid office joke which doesn’t belong here :)


Andrew Farrell
::

@Kyle might take a look at gutenbach, which lets you “print” music to a server with CUPS http://github.com/jhamrick/gutenbach


Jayesh
::

Great idea. I set up crowd applause, you can get mp3s from here (http://www.pacdv.com/sounds/applause-sounds.html)


jose moreira
::

here’s a list of sound files you should like:

http://tf2wiki.net/wiki/Engineer\_voice\_commands

highly recommend the “Nice job, pardner.” :)


Zack
::

We use something similar at Primedia : http://github.com/primedia/cc\_alerter

This watches our cruise server and plays build songs and success/failure sounds every time we push a commit.


Nuno
::

I created a simple script that picks a random sound file from a directory, useful if you want a different sound each time. You can find it here: http://aeminium.org/slug/software/shell/\#play.random


Ashit Vora
::

You know what, I like this idea but I dont like the music. Have you tried some music like Yahoo has.

If you don’t know about Yahoo music, go to http://yahoo.com Click on exclamation mark on Yahoo’s logo (violet color on the left of search box).

Good idea btw. :)


Joe Sak
::

I keep a routine schedule, walking away from the computer at 11am & 3pm, and a short perusing in the downstairs bookstore at 5pm.

I listened to that wav and if that thing played every time my colleague and I committed, we would not be happy. No offense :-P


Lindsay
::

More happiness is required in software development. I applaud anyone (no pun) who pushes back against what seems to be a culture of insecure over-seriousness, like everything will turn to sh*t as soon as we relax and begin to enjoy it too much.


Ardell
::

Added to my repo of git hooks I like/use. :-)

http://github.com/ardell/Git-Hooks


Jeff
::

It really is the little things that keep us happy, isn’t it? Thanks for this idea.


Brian Armstrong
::

We do the same thing messing with each others deploy scripts, but it is usually…

  1. “say `i am watching [INSERT SOMETHING BAD]`; open ‘http://www.[DIRTY WEBSITE].com’”

  2. ascii art

  3. a random “texts from last night” pulled out of their rss feed


fonzie
::

for the love of god fix your fonts!


malditogeek
::

Haha nice! If sometime you write Ruby code, you should try my SuperMario gem: http://github.com/malditogeek/redgreen\_supermario :P


Jamie Dubs
::

This is brilliant! Reminds me of a recent project by Evan Roth & Matt Mullenweg that plays “slow clap” videos whenever you press Publish on your WordPress blog: http://vimeo.com/12238385


fry2s
::

edit $PREFIX/share/git-core/templates/hooks/


SomeGuy
::

Sounds pointless to me. Committing doesn’t mean you’ve submitted good code.


Steve Coverdale
::

This is a really happy idea. I’m going to try this myself. Thank you


Mark Essel
::

I used to have James Earl Jones say Impressive for successful compiles in Visual Studio a few years back. Actually I had a bunch of Vader lines for various activities (failed compiles were “You’ve failed me for the last time”). The auditory cues were helpful when swapping windows.

Everyone else in the office thought I was crazy.

They were right.


Mike Krisher
::

inspired by this, I’ve added the playing of the vuvuzela sound to our campfire notification for each production deploy


Brandon Keepers
::

Mike Krisher: great idea.  we joked about doing that a few weeks ago, but haven’t yet.


Andrew Lenards
::

Thanks for the idea!  Appreciate it: http://bit.ly/aiRp46


Tomas
::

Superb idea. Taking it one step further, what if you somehow use the first character of the commit message as a quality indicator, eg. 1-5. (Would that be possible?) Then play say a slow clap for a 1, all the way up to standing ovation for a 5. That would give you an incentive to write better code, assuming you are truthful when self-reporting.

You might not want to do it with a large, shared project, but I’d definitely give it a try with my PhD thesis which I’m planning to track using Git.


Tarmo
::

Very superb indeed! Our team members have happy faces even on boring tasks.


J-P
::

I was going to trial with the sample wav you linked to in the post, and then switch to another wav, but the kids clapping makes me smile every time I commit. It’s a silly thing but it has lifted my mood immeasurably. Thank you!


Tim Novinger
::

It was getting slightly annoying to have to set this up on a per project basis, plus I like switching sounds out periodically, so I whipped up a little rake task to handle it all for me. To use it, throw it a directory as an argument. It defaults to “happykids.wav”.

rake add_happy_commits[/path/to/my/project, vuvuzela.mp3]

Anyone is free to use it. My machine is setup to use /.dotfiles,\ so\ you\ may\ need\ to\ modify\ it\ to\ work\ with\ your\ setup.\ Oh,\ and\ obviously\ you\ need\ your\ own\ sound\ files.\ They\ live\ in/.dotfiles/sounds and are just symlinked to.

https://gist.github.com/1422741


Lecky Lao
::

Not a good idea as it violate the golden rule ‘Less code is less bug’