Code How To Productivity

How to “Push It Good” to Git

Posted .

The Breaks: Stylin' and Profilin' 1982-1990 by Janette Beckman,  published by powerHouse Books

Do you get the song “Push It” by Salt-n-Pepa in your head every time you push code to Git? I do. Here’s how to push code and automatically begin a 4 minute and 29 second celebration with one command. This works on Mac OSX with Spotify.

Save the following short script in a file. I called mine “pushit”. Make sure it’s executable and put it in a directory that is in your $PATH.

Alternatively, you can put the following line in your ~/.profile:

And remember to:

Then, you can push your code to Git and automatically start playing “Push It” in Spotify by typing “pushit” on the command line.

If, for some reason, you’d like to play another song such as Push It by Garbage when you push to git, just find that song in Spotify, right click on it, and copy the Spotify URI. Replace “spotify:track:0GugYsbXWlfLOgsmtsdxzg” in the script above with the URI for your preferred song.

Note that this uses the push.default setting in Git. In order to suppress a warning message, you may want to do:

on the command line. This setting means that the script will only push your current branch to its matching branch on the origin.

Push it Real Good!