Git Hooks Summary / Cheat Sheet

Hook Command When Exit 1 Parameters
applypatch-msg git am before patch applied stops patch application message file name
pre-applypatch git am after applied, before commit stops commit n/a
post-applypatch git am after commit n/a n/a
pre-commit git commit before message stops commit n/a
prepare-commit-msg git commit after default message generated, before invoking editor stops commit message file name, message source type, commit hash
commit-msg git commit inspect, edit, and format the message stops commit message file name
post-commit git commit after commit finished n/a n/a
pre-rebase git rebase before rebase stops rebase n/a
post-checkout git checkout
git clone
after worktree is changed n/a previous HEAD ref, new HEAD ref, is branch
post-merge git merge
git pull
after successful merge completed n/a is squash
pre-receive git push before the first ref is updated stops update n/a (but STDIN gets refs)
update git push before each ref is updated stops present ref from being updated ref name, old object name, new object name
post-receive git push after the last ref is updated n/a n/a (but STDIN gets refs)
post-update git push after the last ref is updated n/a ref names that were updated
pre-auto-gc git gc --auto before garbage collection begins stops garbage collection n/a

Similar Resources

You may want to read Mark Longair's great post about the environment each git hook runs in.