Use a Git hook to push it when you push it
When I heard Paul Irish mention in passing in his JSConf talk that a certain company’s Git repo box would play Salt-n-Pepa’s Push It every time somebody…pushed it, every geeky molecule in my being screamed WANT. It ended up being a tad trickier than I had hoped, but some things in life are worth the extra effort.
Here’s what you need:
- A command-line client that can play mp3 files. VLC has a command line component (cvlc) that works nicely.
- A mp3 of Push It by Salt-n-Pepa (you know you have it).
#!/bin/sh # # Plays Push It when I push it. #
exec cvlc ~/Music/Salt-n-Pepa/Push\ It.mp3 –start-time=14 –stop-time=60 –play-and-exit &
Don’t forget to chmod +x it, and viola - after a push to the repo, the repo machine (hopefully yours) will start jamming.
Unfortunately there is no client-side post-push in Git. That means you won’t be getting your jam on when you commit to a Github repo via a standard hook. This is where a normal person would have hung up their geek-cleats. I am not a normal person.
Create a .git/hooks/post-push file and make it just like the above. Then head to your .git/config file and tack this on the end:
[alias] xpush = !git push $! $2 && $(git rev-parse --git-dir)/hooks/post-push
Here we’re making an alias to push called xpush that does what the standard push does and then executes our post-push hook. Then give it a git xpush -u origin master off to Github and prepare to boogie.