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 Keepers

Comments:


Post a Comment

(optional)
(optional — will be included as a link.)
  1. If anyone knows how to set up a global post-commit hook, please share.  I have to symlink this into every project for now.

    August 04, 2010 at 0:09 AM
  2. Awesome. I like the idea of crowds clapping.

    August 04, 2010 at 0:06 AM
  3. This is genius. + 400 happy geek points. :)

    August 04, 2010 at 0:23 AM
  4. 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.

    August 04, 2010 at 7:55 AM
  5. 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 

    August 04, 2010 at 8:49 AM
  6. Love it, I went with a nice golf clap

    August 04, 2010 at 10:17 AM
  7. @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

    August 04, 2010 at 10:25 AM
  8. Oh, I quite like that.

    August 04, 2010 at 9:58 AM
  9. On successful deploy – http://gist.github.com/508218

    zack
    zack
    August 04, 2010 at 10:29 AM
  10. I find your Gravatar animations very happy. :-)

    August 04, 2010 at 10:38 AM
  11. cp .git/hooks/post-commit.sample .git/hooks/post-commit
    echo “afplay ~/.git/happykids.wav > /dev/null 2>&1 &” >> .git/hooks/post-commit

    Carlo
    Carlo
    August 04, 2010 at 10:50 AM
  12. It’d be cool to if the office loudspeakers would play something every time code was rolled into the master branch.

    August 04, 2010 at 11:14 AM
  13. 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 :)

    August 04, 2010 at 11:18 AM
  14. @Kyle
    might take a look at gutenbach, which lets you “print” music to a server with CUPS
    http://github.com/jhamrick/gutenbach

    Andrew Farrell
    Andrew Farrell
    August 04, 2010 at 11:22 AM
  15. Great idea. I set up crowd applause, you can get mp3s from here (http://www.pacdv.com/sounds/applause-sounds.html)

    August 04, 2010 at 11:43 AM
  16. here’s a list of sound files you should like:

    http://tf2wiki.net/wiki/Engineer_voice_commands

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

    August 04, 2010 at 12:02 PM
  17. 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.

    August 04, 2010 at 12:46 PM
  18. 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

    August 04, 2010 at 12:59 PM
  19. 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. :)

    August 04, 2010 at 13:06 PM
  20. 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

    August 04, 2010 at 13:19 PM
  21. 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. 

    August 04, 2010 at 14:32 PM
  22. Added to my repo of git hooks I like/use. :-)

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

    August 04, 2010 at 14:46 PM
  23. It really is the little things that keep us happy, isn’t it? Thanks for this idea.

    Jeff
    Jeff
    August 04, 2010 at 14:51 PM
  24. 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

    August 04, 2010 at 14:36 PM
  25. for the love of god fix your fonts!

    fonzie
    fonzie
    August 04, 2010 at 15:47 PM
  26. Haha nice! If sometime you write Ruby code, you should try my SuperMario gem: http://github.com/malditogeek/redgreen_supermario :P

    August 04, 2010 at 15:47 PM
  27. 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

    August 04, 2010 at 16:48 PM
  28. edit $PREFIX/share/git-core/templates/hooks/

    fry2s
    fry2s
    August 05, 2010 at 3:58 AM
  29. Sounds pointless to me. Committing doesn’t mean you’ve submitted good code.

    SomeGuy
    SomeGuy
    August 05, 2010 at 5:55 AM
  30. This is a really happy idea. I’m going to try this myself. Thank you

    August 05, 2010 at 9:22 AM
  31. 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.

    August 05, 2010 at 11:18 AM
  32. inspired by this, I’ve added the playing of the vuvuzela sound to our campfire notification for each production deploy

    August 05, 2010 at 16:20 PM
  33. Mike Krisher: great idea.  we joked about doing that a few weeks ago, but haven’t yet.

    August 05, 2010 at 16:33 PM
  34. Thanks for the idea!  Appreciate it: http://bit.ly/aiRp46

    August 05, 2010 at 21:21 PM
  35. 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.

    Tomas
    Tomas
    August 09, 2010 at 12:49 PM
  36. Very superb indeed! Our team members have happy faces even on boring tasks.

    Tarmo
    Tarmo
    September 17, 2010 at 15:38 PM
  37. 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!

    J-P
    J-P
    October 01, 2010 at 5:44 AM
  38. 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

    December 02, 2011 at 5:41 AM
  39. Not a good idea as it violate the golden rule ‘Less code is less bug’

    August 23, 2012 at 20:27 PM