Skip to content

Instantly share code, notes, and snippets.

@asymmetric
Forked from hannestyden/post-checkout
Created October 28, 2010 12:25
Show Gist options
  • Save asymmetric/651233 to your computer and use it in GitHub Desktop.
Save asymmetric/651233 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Put this in your .git/hooks/post-checkout and smoke it.
function current_branch_name {
git symbolic-ref HEAD | cut -d '/' -f 3
}
if [ $(current_branch_name) == 'master' ]; then
lines[0]="Master, Master, where's the dreams that I've been after?"
lines[1]="Master, Master, you promised only lies"
lines[2]="Laughter, laughter, all I hear or see is laughter"
lines[3]="Laughter, laughter, laughing at my cries"
echo " ${lines[$((RANDOM%${#lines[*]}))]}";
fi
@asymmetric
Copy link
Author

answer is here.

also, git name-rev --name-only HEAD is more succint but does not work in all cases

i'm so good at finding answers on SO ;)

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