Search notes:

.git/hooks

Hooks are customization scripts used by various git commands. These scripts allow a developer to add functionality or checking.
A hook can abort a command if something doesn't meet a requirement.
When git init is executed, some sample hooks are installed. But they are initially disabled. In order to enable these, the .sample suffiex needs to be removed from the files.
The default directory for hooks is in the directory hooks below the GIT directory (usually .git). This default can be changed with the core.hooksPath option.

Commit related hooks

pre-commit The first hook that is run, used to check the quality of the state to be committed. Returning non-zero aborts commit process.
prepare-commit-msg Run before commit editor message is shown.
commit-msg Has as parameter the path of the file that contains the commit message.
post-commit Called when commit process is done.

Email related hooks

applypatch-msg
pre-applypatch Run when git am is executed.
post-applypatch

Other client sidehooks

pre-rebase
post-rewrite Run, for example, by git commit --amend or git rebase (but not git filter-branch)
post-checkout Executed after running git checkout
post-merge Executed after running git merge
pre-push Run as part of git-push after the remote refs have been updated but before any objects have been transferred.
pre-auto-gc Invoked before git's garbage collection is invoked (see also git gc --auto).

Server side hooks

pre-receive
update
post-receive

TODO

fsmonitor-watchman
post-update
pre-merge-commit

See also

$GIT_COMMON_DIR
.git directory structure

Index