Title: Theory / Important / CS / Softw / VCS / Git / Hook

name: applypatch-msg
command: am
abort: yes
args: fileToCommitMessage
expected: edit the commit message
default: runs the commit-msg hook

name: pre-applypatch
command: am
before: a commit is made
after: the patch is applied
abort: yes
default: runs the pre-commit hook

name: post-applypatch
command: am
after: the patch is applied and a commit is made.
expected: notification only

name: pre-commit
command: commit
before: obtaining the proposed commit log message and making a commit
abort: yes
default: catches introduction of lines with trailing whitespaces and aborts the commit when such a line is found. If not hooks.allownonascii, fail in case of non-ASCII filenames
bypassed: true

name: pre-merge-commit
command: merge
after: the merge has been carried out successfully and before obtaining the proposed commit log message to make a commit
when: merge can be resolved automatically
abort: yes
default: pre-commit hook

name: prepare-commit-msg
command: commit
before: the editor is started
after: preparing the default log message
abort: yes
args: 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).
expected: edit the message file in place
default: removes the help message found in the commented portion of the commit template.

name: commit-msg
command: commit/merge
abort: yes
args: fileWithCommitMessage
expected: edit message in place and validate it
default: detects duplicate Signed-off-by trailers, and aborts the commit if one is found

name: post-commit
command: commit
after: commit is made
expected: notification

name: pre-rebase
command: rebase
args: upstreamFromWhichTheSeriesWasForked [branchBeingRebasedIfAny]
expected: prevent a branch from getting rebased

name: post-merge
command: pull
after: git merge
args: isASquashMerge
expected: in conjunction with a corresponding pre-commit hook to save and restore any form of metadata associated with the working tree (e.g.: permissions/ownership, ACLS, etc)

name: pre-push
command: push
abort: yes
args: nameOfRemote locationOfRemote
stdin: Information about what is to be pushed is provided on the hook’s standard input with lines of the form:
<local ref> SP <local object name> SP <remote ref> SP <remote object name> LF

name: pre-receive
command: receive-pack
before: starting to update refs on the remote repository
abort: yes
stdin: for each ref to be updated it receives on standard input a line of the format:
<old-value> SP <new-value> SP <ref-name> LF
where <old-value> is the old object name stored in the ref, <new-value> is the new object name to be stored in the ref and <ref-name> is the full name of the ref. When creating a new ref, <old-value> is the all-zeroes object name.

name: update
command: receive-pack
before: updating the ref on the remote repository
abort: yes
args: nameOfRefBeingUpdated oldObjectNameStoredInTheRef newObjectNameToStoreInTheRef
expected: prevent forced update on certain refs by making sure that the object name is a commit object that is a descendant of the commit object named by the old object name
default: prevents unannotated tags to be pushed if not hooks.allowunannotated

name: proc-receive
command: receive-pack
before: todo

name: post-receive
command: receive-pack
after: all the refs have been updated
stdin: same as pre-receive

name: post-update
expected: deprecated. Uses post-receive

name: reference-transaction
command: command that performs reference updates
when: The hook does not cover symbolic references (but that may change in the future).
args: the current state the given reference transaction is in:
- "prepared": All reference updates have been queued to the transaction and references were locked on disk.
- "committed": The reference transaction was committed and all references now have their respective new value.
- "aborted": The reference transaction was aborted, no changes were performed and the locks have been released.
stdin: For each reference update that was added to the transaction, the hook receives on standard input a line of the format:
<old-value> SP <new-value> SP <ref-name> LF
where <old-value> is the old object name passed into the reference transaction, <new-value> is the new object name to be stored in the ref and <ref-name> is the full name of the ref. When force updating the reference regardless of its current value or when the reference is to be created anew, <old-value> is the all-zeroes object name.

name: push-to-checkout
command: receive-pack
when: the push tries to update the branch that is currently checked out and the receive.denyCurrentBranch configuration variable is set to updateInstead
abort: yes
args: the commit with which the tip of the current branch is going to be updated
expected: override the default behaviour.

name: pre-auto-gc
command: gc --auto
abort: yes

name: post-rewrite
command: commit --amend/rebase
args: amendOrRebase
stdin: The hook receives a list of the rewritten commits on stdin, in the format
<old-object-name> SP <new-object-name> [ SP <extra-info> ] LF

name: sendemail-validate
command: send-email
abort: yes
args: nameOfFileThatHoldsEMailToBeSent

name: fsmonitor-watchen
command: todo

name: p4-*
command: todo

name: post-index-change
when: when the index is written in read-cache.c do_write_locked_index.
args: whetherWorkingDirectoryWasUpdated whetherTheIndexWasUpdated