is invoked after the patch is applied and a commit is made.
This hook is meant primarily for notification, and cannot affect
the outcome of `git am`.
pre-commit
~~~~~~~~~~
This hook is invoked by linkgit:git-commit[1], and can be bypassed
with the `--no-verify` option. It takes no parameters, and is
invoked before obtaining the proposed commit log message and
making a commit. Exiting with a non-zero status from this script
causes the `git commit` command to abort before creating a commit.
The default 'pre-commit' hook, when enabled, catches introduction
of lines with trailing whitespaces and aborts the commit when
such a line is found.
All the `git commit` hooks are invoked with the environment
variable `GIT_EDITOR=:` if the command will not bring up an editor
to modify the commit message.
The default 'pre-commit' hook, when enabled--and with the
`hooks.allownonascii` config option unset or set to false--prevents
the use of non-ASCII filenames.
pre-merge-commit
~~~~~~~~~~~~~~~~
This hook is invoked by linkgit:git-merge[1], and can be bypassed
with the `--no-verify` option. It takes no parameters, and is
invoked after the merge has been carried out successfully and before
obtaining the proposed commit log message to
make a commit. Exiting with a non-zero status from this script
causes the `git merge` command to abort before creating a commit.
The default 'pre-merge-commit' hook, when enabled, runs the
'pre-commit' hook, if the latter is enabled.
This hook is invoked with the environment variable
`GIT_EDITOR=:` if the command will not bring up an editor
to modify the commit message.
If the merge cannot be carried out automatically, the conflicts
need to be resolved and the result committed separately (see
linkgit:git-merge[1]). At that point, this hook will not be executed,
but the 'pre-commit' hook will, if it is enabled.
prepare-commit-msg
~~~~~~~~~~~~~~~~~~
This hook is invoked by linkgit:git-commit[1] right after preparing the
default log message, and before the editor is started.
It takes one to three parameters. The first is the name of the file
that contains the commit log message. The second is the source of the commit
message, and can be: `message` (if a `-m` or `-F` option was
given); `template` (if a `-t` option was given or the
configuration option `commit.template` is set); `merge` (if the
commit is a merge or a `.git/MERGE_MSG` file exists); `squash`
(if a `.git/SQUASH_MSG` file exists); or `commit`, followed by
a commit object name (if a `-c`, `-C` or `--amend` option was given).
If the exit status is non-zero, `git commit` will abort.
The purpose of the hook is to edit the message file in place, and
it is not suppressed by the `--no-verify` option. A non-zero exit
means a failure of the hook and aborts the commit. It should not
be used as a replacement for the pre-commit hook.
The sample `prepare-commit-msg` hook that comes with Git removes the
help message found in the commented portion of the commit template.
commit-msg
~~~~~~~~~~
This hook is invoked by linkgit:git-commit[1] and linkgit:git-merge[1], and can be
bypassed with the `--no-verify` option. It takes a single parameter,
the name of the file that holds the proposed commit log message.
Exiting with a non-zero status causes the command to abort.
The hook is allowed to edit the message file in place, and can be used
to normalize the message into some project standard format. It
can also be used to refuse the commit after inspecting the message
file.
The default 'commit-msg' hook, when enabled, detects duplicate
`Signed-off-by` trailers, and aborts the commit if one is found.
post-commit
~~~~~~~~~~~
This hook is invoked by linkgit:git-commit[1]. It takes no parameters, and is
invoked after a commit is made.
This hook is meant primarily for notification, and cannot affect
the outcome of `git commit`.
pre-rebase
~~~~~~~~~~
This hook is called by linkgit:git-rebase[1] and can be used to prevent a
branch from getting rebased.