Collective Idea

Collective Idea Logo

Brandon Keepers

Happy Git Commits

By Brandon Keepers on August 03, 2010 in code and git

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?

By Brandon Keepers on August 03, 2010 in code and git

39 Comments

  1. Brandon Keepers

    Brandon Keepers August 04, 2010 http://collectiveidea.com

    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. John Nunemaker

    John Nunemaker August 04, 2010 http://orderedlist.com

    Awesome. I like the idea of crowds clapping.

  3. Tim Novinger

    Tim Novinger August 04, 2010 http://www.timnovinger.com

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

  4. Brian Ryckbost

    Brian Ryckbost August 04, 2010 http://ryckbost.com

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

    Bumi August 04, 2010 http://railslove.com

    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. Marshall Huss

    Marshall Huss August 04, 2010 http://mwhuss.com

    Love it, I went with a nice golf clap

  7. Benjamin Meyer

    Benjamin Meyer August 04, 2010 http://benjamin-meyer.blogspot.com/

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

    Matt Darby August 04, 2010 http://protectedmethod.com

    Oh, I quite like that.

  9. zack

    zack August 04, 2010

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

  10. christian

    christian August 04, 2010 http://hymnos.existenz.ch

    I find your Gravatar animations very happy. :-)

  11. Carlo

    Carlo August 04, 2010

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

  12. Kyle Mathews

    Kyle Mathews August 04, 2010 http://kyle.mathews2000.com

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

  13. Tomer

    Tomer August 04, 2010 http://konzepz.com/

    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. Andrew Farrell

    Andrew Farrell August 04, 2010

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

  15. Jayesh

    Jayesh August 04, 2010 http://www.altcanvas.com

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

  16. jose moreira

    jose moreira August 04, 2010 http://zemanel.posterous.com

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

    http://tf2wiki.net/wiki/Engineer_voice_commands

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

  17. Zack

    Zack August 04, 2010 http://www.zadams.com

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

    Nuno August 04, 2010 http://aeminium.org/slug/

    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. Ashit Vora

    Ashit Vora August 04, 2010 http://voratec.com

    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. Joe Sak

    Joe Sak August 04, 2010 http://www.joesak.com

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

    Lindsay August 04, 2010 http://scenejs.org

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

    Ardell August 04, 2010 http://github.com/ardell

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

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

  23. Jeff

    Jeff August 04, 2010

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

  24. Brian Armstrong

    Brian Armstrong August 04, 2010 http://www.startbreakingfree.com

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

    fonzie August 04, 2010

    for the love of god fix your fonts!

  26. malditogeek

    malditogeek August 04, 2010 http://twitter.com/malditogeek

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

  27. Jamie Dubs

    Jamie Dubs August 04, 2010 http://jamiedubs.com

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

    fry2s August 05, 2010

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

  29. SomeGuy

    SomeGuy August 05, 2010

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

  30. Steve Coverdale

    Steve Coverdale August 05, 2010 http://steve.coverdale.me

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

  31. Mark Essel

    Mark Essel August 05, 2010 http://www.victusspiritus.com

    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. Mike Krisher

    Mike Krisher August 05, 2010 http://www.mikekrisher.com

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

  33. Brandon Keepers

    Brandon Keepers August 05, 2010 http://collectiveidea.com

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

  34. Andrew Lenards

    Andrew Lenards August 05, 2010 http://gigism.blogspot.com/

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

  35. Tomas

    Tomas August 09, 2010

    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

    Tarmo September 17, 2010

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

  37. J-P

    J-P October 01, 2010 http://www.jpstacey.info/

    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. Tim Novinger

    Tim Novinger December 02, 2011 http://www.timnovinger.com

    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. Lecky Lao

    Lecky Lao August 23, 2012 http://leckylao.com

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

Post a Comment

Contact Us

Find us on Google Maps
Collective Idea
44 East 8th Street, Suite 410
Holland, Michigan 49423 USA 42.790334-86.105251

Follow us on the Interwebs

We are currently available for medium and long term projects. Please get in touch if we can be of service.