Skip to content

Instantly share code, notes, and snippets.

@mroth
Last active January 25, 2017 17:58
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mroth/1812c71eb1326aa9b92f72870c248155 to your computer and use it in GitHub Desktop.
Save mroth/1812c71eb1326aa9b92f72870c248155 to your computer and use it in GitHub Desktop.
Adds the currently playing iTunes track to your prepared git commit message.
#!/bin/bash
# Adds the currently playing iTunes track to your prepared commit message.
#
# To install, save in repo as chmod +x to .git/hooks/prepare-commit-msg
SONG=`osascript -e 'tell application "iTunes" to if player state is playing then "♬ : " & artist of current track & " / " & name of current track'`
if [[ $SONG ]]; then
echo -e "$(cat $1)\n\n$SONG" > $1
fi
@mroth
Copy link
Author

mroth commented Jan 21, 2017

Now updated to work better if you pass your normal commit message with -m.

git-music-ss2

Hence git commit -m "This is my normal short commit message here." would still look nice when GitHub displays things in history:
git-music-results-github-app-ss

Idea from this tweet which nerd sniped me: https://twitter.com/sdboyer/status/821097132983730178

@mroth
Copy link
Author

mroth commented Jan 25, 2017

NOTE: A more robust version of this with Spotify support and an installer now exists at: https://github.com/mroth/git-muzak

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment