Just wrote this commit-msg hook for git that just has me looking forward to each commit to the project. It's only for OSX and its sole purpose is to add a tag that looks like a custom HTTP header which shows what song was playing when the user created the commit. It only works with iTunes and can handle when iTunes is paused.
Here's an example of how it looks:
Without further ado, here's the script. Move it to your git repository's .git/hooks directory and rename it to "commit-msg". Throw in a chmod +x .git/hook/commit-msg and you're good to go! If you already have a commit-msg hook, you can add this snippet to the end of it (minus the hash-bang line)
Happy committing!
Here's an example of how it looks:
X-Commit-Powered-By: Cake - Short Skirt / Long JacketWhen it detects that your iTunes is paused, it outputs this instead:
X-Commit-Powered-By: Silent MeditationYou can change all this, of course, with a little bash-fu.
Without further ado, here's the script. Move it to your git repository's .git/hooks directory and rename it to "commit-msg". Throw in a chmod +x .git/hook/commit-msg and you're good to go! If you already have a commit-msg hook, you can add this snippet to the end of it (minus the hash-bang line)
#!/bin/sh
# Adds the currently playing iTunes track to the commit message
# Add a blank line
echo >> $1
state=`osascript -e 'tell application "iTunes" to player state as string'`;
if [ $state = "playing" ]; then
artist=`osascript -e 'tell application "iTunes" to artist of current track as string'`;
track=`osascript -e 'tell application "iTunes" to name of current track as string'`;
echo "X-Commit-Powered-By: $artist - $track" >> $1;
else
echo "X-Commit-Powered-By: Silent Meditation" >> $1;
fi
Happy committing!