Happy Git Commits

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?

brandon@opensoul.org

Comments

  1. August 04, 2010 at 4:09 AM

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

  2. August 04, 2010 at 4:06 AM

    Awesome. I like the idea of crowds clapping.

  3. August 04, 2010 at 4:23 AM

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

  4. August 04, 2010 at 11:55 AM

    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.

  5. August 04, 2010 at 12:49 PM

    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 

  6. August 04, 2010 at 14:17 PM

    Love it, I went with a nice golf clap

  7. August 04, 2010 at 14:25 PM

    @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

  8. August 04, 2010 at 13:58 PM

    Oh, I quite like that.

  9. zhalbrecht@gmail.com
    zack
    August 04, 2010 at 14:29 PM

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

  10. August 04, 2010 at 14:38 PM

    I find your Gravatar animations very happy. :-)

  11. carlo@carlocostantini.ca
    Carlo
    August 04, 2010 at 14:50 PM

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

  12. August 04, 2010 at 15:14 PM

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

  13. August 04, 2010 at 15:18 PM

    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 :)

  14. afarrell@mit.edu
    Andrew Farrell
    August 04, 2010 at 15:22 PM

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

  15. August 04, 2010 at 15:43 PM

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

  16. August 04, 2010 at 16:02 PM

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

    http://tf2wiki.net/wiki/Engineer_voice_commands

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

  17. August 04, 2010 at 16:46 PM

    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.

  18. August 04, 2010 at 16:59 PM

    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

  19. August 04, 2010 at 17:06 PM

    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. :)

  20. August 04, 2010 at 17:19 PM

    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

  21. August 04, 2010 at 18:32 PM

    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. 

  22. August 04, 2010 at 18:46 PM

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

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

  23. jeffroberts1@gmail.com
    Jeff
    August 04, 2010 at 18:51 PM

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

  24. August 04, 2010 at 18:36 PM

    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

  25. blahmail@lalalla.com
    fonzie
    August 04, 2010 at 19:47 PM

    for the love of god fix your fonts!

  26. August 04, 2010 at 19:47 PM

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

  27. August 04, 2010 at 20:48 PM

    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

  28. frytaz@gmail.com
    fry2s
    August 05, 2010 at 7:58 AM

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

  29. ammaar.limbada@gmail.com
    SomeGuy
    August 05, 2010 at 9:55 AM

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

  30. August 05, 2010 at 13:22 PM

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

  31. August 05, 2010 at 15:18 PM

    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.

  32. August 05, 2010 at 20:20 PM

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

  33. August 05, 2010 at 20:33 PM

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

  34. August 06, 2010 at 1:21 AM

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

  35. email@swemerican.com
    Tomas
    August 09, 2010 at 16:49 PM

    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.

  36. tarmo.talu@wisesoft.ee
    Tarmo
    September 17, 2010 at 19:38 PM

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

  37. jp.stacey@gmail.com
    J-P
    October 01, 2010 at 9:44 AM

    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!

  38. December 02, 2011 at 10:41 AM

    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

  39. August 24, 2012 at 0:27 AM

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