Using and Abusing Git hooks
Joseph Hsu, developer at Academic Software Plus
@jhsu
github.com/jhsu
Joseph Hsu, developer at Academic Software Plus
@jhsu
github.com/jhsu
git init
chmod +x itchmod +x .git/hooks/pre-commit
exit 1
git commit => pre-commitgit diff --staged --name-only to find what files are about to be commitedconsole.log(...)
git commit => post-commitAfter the entire commit process is completed.
afplay ~/.git/happykids.wav > /dev/null 2>&1 &
git commit => commit-msggit merge => {pre,post}-mergegit diff HEAD^)

#!/usr/bin/env bash
curl -s http://whatthecommit.com/index.txt > $1
"i think i fixed a bug..."
"committing according to the Prophecy."
"tl;dr"
git log --format='%aN' | sort -u | while read x; do echo \
"`expr $RANDOM % 1000`:$x"; done | sort -n| sed 's/[0-9]*://' | head -n 1