]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/githooks.txt
Merge branch 'ea/blame-use-oideq'
[thirdparty/git.git] / Documentation / githooks.txt
CommitLineData
a5af0e2c
CC
1githooks(5)
2===========
3
4NAME
5----
2de9b711 6githooks - Hooks used by Git
a5af0e2c
CC
7
8SYNOPSIS
9--------
867ad08a 10$GIT_DIR/hooks/* (or \`git config core.hooksPath`/*)
a5af0e2c
CC
11
12
13DESCRIPTION
14-----------
6d35cc76 15
867ad08a
ÆAB
16Hooks are programs you can place in a hooks directory to trigger
17actions at certain points in git's execution. Hooks that don't have
18the executable bit set are ignored.
19
20By default the hooks directory is `$GIT_DIR/hooks`, but that can be
21changed via the `core.hooksPath` configuration variable (see
22linkgit:git-config[1]).
49fa52fd
ÆAB
23
24Before Git invokes a hook, it changes its working directory to either
501d3cd7
SR
25$GIT_DIR in a bare repository or the root of the working tree in a non-bare
26repository. An exception are hooks triggered during a push ('pre-receive',
27'update', 'post-receive', 'post-update', 'push-to-checkout') which are always
28executed in $GIT_DIR.
49fa52fd
ÆAB
29
30Hooks can get their arguments via the environment, command-line
31arguments, and stdin. See the documentation for each hook below for
32details.
33
9dba84d8 34`git init` may copy hooks to the new repository, depending on its
49fa52fd
ÆAB
35configuration. See the "TEMPLATE DIRECTORY" section in
36linkgit:git-init[1] for details. When the rest of this document refers
37to "default hooks" it's talking about the default template shipped
38with Git.
39
40The currently supported hooks are described below.
6d35cc76 41
6d71c1dc
BW
42HOOKS
43-----
44
6d35cc76 45applypatch-msg
6d71c1dc 46~~~~~~~~~~~~~~
6d35cc76 47
9dba84d8 48This hook is invoked by linkgit:git-am[1]. It takes a single
6d35cc76 49parameter, the name of the file that holds the proposed commit
9dba84d8 50log message. Exiting with a non-zero status causes `git am` to abort
de0824ed 51before applying the patch.
6d35cc76
JH
52
53The hook is allowed to edit the message file in place, and can
54be used to normalize the message into some project standard
de0824ed
ÆAB
55format. It can also be used to refuse the commit after inspecting
56the message file.
6d35cc76 57
45ad9b50
JF
58The default 'applypatch-msg' hook, when enabled, runs the
59'commit-msg' hook, if the latter is enabled.
6d35cc76
JH
60
61pre-applypatch
6d71c1dc 62~~~~~~~~~~~~~~
6d35cc76 63
9dba84d8 64This hook is invoked by linkgit:git-am[1]. It takes no parameter, and is
47458bb9
CC
65invoked after the patch is applied, but before a commit is made.
66
67If it exits with non-zero status, then the working tree will not be
68committed after applying the patch.
6d35cc76
JH
69
70It can be used to inspect the current working tree and refuse to
71make a commit if it does not pass certain test.
72
45ad9b50
JF
73The default 'pre-applypatch' hook, when enabled, runs the
74'pre-commit' hook, if the latter is enabled.
6d35cc76
JH
75
76post-applypatch
6d71c1dc 77~~~~~~~~~~~~~~~
6d35cc76 78
9dba84d8 79This hook is invoked by linkgit:git-am[1]. It takes no parameter,
6d35cc76
JH
80and is invoked after the patch is applied and a commit is made.
81
82This hook is meant primarily for notification, and cannot affect
9dba84d8 83the outcome of `git am`.
6d35cc76
JH
84
85pre-commit
6d71c1dc 86~~~~~~~~~~
6d35cc76 87
9dba84d8 88This hook is invoked by linkgit:git-commit[1], and can be bypassed
de0824ed 89with the `--no-verify` option. It takes no parameters, and is
6d35cc76 90invoked before obtaining the proposed commit log message and
de0824ed 91making a commit. Exiting with a non-zero status from this script
9dba84d8 92causes the `git commit` command to abort before creating a commit.
6d35cc76 93
45ad9b50 94The default 'pre-commit' hook, when enabled, catches introduction
6d35cc76 95of lines with trailing whitespaces and aborts the commit when
45ad9b50 96such a line is found.
6d35cc76 97
9dba84d8 98All the `git commit` hooks are invoked with the environment
406400ce
PB
99variable `GIT_EDITOR=:` if the command will not bring up an editor
100to modify the commit message.
101
3e14dd2c
RD
102The default 'pre-commit' hook, when enabled--and with the
103`hooks.allownonascii` config option unset or set to false--prevents
104the use of non-ASCII filenames.
105
6098817f
MG
106pre-merge-commit
107~~~~~~~~~~~~~~~~
108
bc40ce4d
MG
109This hook is invoked by linkgit:git-merge[1], and can be bypassed
110with the `--no-verify` option. It takes no parameters, and is
6098817f
MG
111invoked after the merge has been carried out successfully and before
112obtaining the proposed commit log message to
113make a commit. Exiting with a non-zero status from this script
114causes the `git merge` command to abort before creating a commit.
115
116The default 'pre-merge-commit' hook, when enabled, runs the
117'pre-commit' hook, if the latter is enabled.
118
119This hook is invoked with the environment variable
120`GIT_EDITOR=:` if the command will not bring up an editor
121to modify the commit message.
122
123If the merge cannot be carried out automatically, the conflicts
124need to be resolved and the result committed separately (see
125linkgit:git-merge[1]). At that point, this hook will not be executed,
126but the 'pre-commit' hook will, if it is enabled.
127
8089c85b 128prepare-commit-msg
6d71c1dc 129~~~~~~~~~~~~~~~~~~
8089c85b 130
9dba84d8 131This hook is invoked by linkgit:git-commit[1] right after preparing the
8089c85b
PB
132default log message, and before the editor is started.
133
134It takes one to three parameters. The first is the name of the file
99686960 135that contains the commit log message. The second is the source of the commit
5d6b3a9e
SG
136message, and can be: `message` (if a `-m` or `-F` option was
137given); `template` (if a `-t` option was given or the
8089c85b
PB
138configuration option `commit.template` is set); `merge` (if the
139commit is a merge or a `.git/MERGE_MSG` file exists); `squash`
140(if a `.git/SQUASH_MSG` file exists); or `commit`, followed by
d5fa1f1a 141a commit SHA-1 (if a `-c`, `-C` or `--amend` option was given).
8089c85b 142
9dba84d8 143If the exit status is non-zero, `git commit` will abort.
8089c85b
PB
144
145The purpose of the hook is to edit the message file in place, and
6cf378f0 146it is not suppressed by the `--no-verify` option. A non-zero exit
8089c85b
PB
147means a failure of the hook and aborts the commit. It should not
148be used as replacement for pre-commit hook.
149
0ef1a4e3
KS
150The sample `prepare-commit-msg` hook that comes with Git removes the
151help message found in the commented portion of the commit template.
152
6d35cc76 153commit-msg
6d71c1dc 154~~~~~~~~~~
6d35cc76 155
9dba84d8 156This hook is invoked by linkgit:git-commit[1] and linkgit:git-merge[1], and can be
ce82eddf
SB
157bypassed with the `--no-verify` option. It takes a single parameter,
158the name of the file that holds the proposed commit log message.
159Exiting with a non-zero status causes the command to abort.
6d35cc76 160
de0824ed
ÆAB
161The hook is allowed to edit the message file in place, and can be used
162to normalize the message into some project standard format. It
163can also be used to refuse the commit after inspecting the message
164file.
6d35cc76 165
45ad9b50
JF
166The default 'commit-msg' hook, when enabled, detects duplicate
167"Signed-off-by" lines, and aborts the commit if one is found.
6d35cc76
JH
168
169post-commit
6d71c1dc 170~~~~~~~~~~~
6d35cc76 171
9dba84d8 172This hook is invoked by linkgit:git-commit[1]. It takes no parameters, and is
de0824ed 173invoked after a commit is made.
6d35cc76
JH
174
175This hook is meant primarily for notification, and cannot affect
9dba84d8 176the outcome of `git commit`.
6d35cc76 177
00e5d48a 178pre-rebase
6d71c1dc 179~~~~~~~~~~
00e5d48a 180
9dba84d8 181This hook is called by linkgit:git-rebase[1] and can be used to prevent a
0414acc3
TK
182branch from getting rebased. The hook may be called with one or
183two parameters. The first parameter is the upstream from which
184the series was forked. The second parameter is the branch being
185rebased, and is not set when rebasing the current branch.
00e5d48a 186
1abbe475 187post-checkout
6d71c1dc 188~~~~~~~~~~~~~
1abbe475 189
d787d311
NTND
190This hook is invoked when a linkgit:git-checkout[1] or
191linkgit:git-switch[1] is run after having updated the
1abbe475
JE
192worktree. The hook is given three parameters: the ref of the previous HEAD,
193the ref of the new HEAD (which may or may not have changed), and a flag
194indicating whether the checkout was a branch checkout (changing branches,
195flag=1) or a file checkout (retrieving a file from the index, flag=0).
3100fd55
JH
196This hook cannot affect the outcome of `git switch` or `git checkout`,
197other than that the hook's exit status becomes the exit status of
198these two commands.
1abbe475 199
9dba84d8 200It is also run after linkgit:git-clone[1], unless the `--no-checkout` (`-n`) option is
24c11552 201used. The first parameter given to the hook is the null-ref, the second the
9dba84d8
AH
202ref of the new HEAD and the flag is always 1. Likewise for `git worktree add`
203unless `--no-checkout` is used.
24c11552 204
1abbe475
JE
205This hook can be used to perform repository validity checks, auto-display
206differences from the previous HEAD if different, or set working dir metadata
207properties.
208
46232915 209post-merge
6d71c1dc 210~~~~~~~~~~
46232915 211
9dba84d8 212This hook is invoked by linkgit:git-merge[1], which happens when a `git pull`
46232915
JE
213is done on a local repository. The hook takes a single parameter, a status
214flag specifying whether or not the merge being done was a squash merge.
9dba84d8 215This hook cannot affect the outcome of `git merge` and is not executed,
2b3e60c2 216if the merge failed due to conflicts.
46232915
JE
217
218This hook can be used in conjunction with a corresponding pre-commit hook to
219save and restore any form of metadata associated with the working tree
f745acb0 220(e.g.: permissions/ownership, ACLS, etc). See contrib/hooks/setgitperms.perl
af6fb4c8 221for an example of how to do this.
46232915 222
ec55559f
AS
223pre-push
224~~~~~~~~
225
9dba84d8
AH
226This hook is called by linkgit:git-push[1] and can be used to prevent
227a push from taking place. The hook is called with two parameters
228which provide the name and location of the destination remote, if a
229named remote is not being used both values will be the same.
ec55559f
AS
230
231Information about what is to be pushed is provided on the hook's standard
232input with lines of the form:
233
234 <local ref> SP <local sha1> SP <remote ref> SP <remote sha1> LF
235
236For instance, if the command +git push origin master:foreign+ were run the
237hook would receive a line like the following:
238
239 refs/heads/master 67890 refs/heads/foreign 12345
240
d5fa1f1a
TA
241although the full, 40-character SHA-1s would be supplied. If the foreign ref
242does not yet exist the `<remote SHA-1>` will be 40 `0`. If a ref is to be
ec55559f 243deleted, the `<local ref>` will be supplied as `(delete)` and the `<local
d5fa1f1a
TA
244SHA-1>` will be 40 `0`. If the local commit was specified by something other
245than a name which could be expanded (such as `HEAD~`, or a SHA-1) it will be
ec55559f
AS
246supplied as it was originally given.
247
9dba84d8 248If this hook exits with a non-zero status, `git push` will abort without
ec55559f
AS
249pushing anything. Information about why the push is rejected may be sent
250to the user by writing to standard error.
251
cbb84e5d
JH
252[[pre-receive]]
253pre-receive
6d71c1dc 254~~~~~~~~~~~
cbb84e5d 255
9dba84d8
AH
256This hook is invoked by linkgit:git-receive-pack[1] when it reacts to
257`git push` and updates reference(s) in its repository.
cbb84e5d
JH
258Just before starting to update refs on the remote repository, the
259pre-receive hook is invoked. Its exit status determines the success
260or failure of the update.
261
262This hook executes once for the receive operation. It takes no
263arguments, but for each ref to be updated it receives on standard
264input a line of the format:
265
266 <old-value> SP <new-value> SP <ref-name> LF
267
268where `<old-value>` is the old object name stored in the ref,
269`<new-value>` is the new object name to be stored in the ref and
270`<ref-name>` is the full name of the ref.
271When creating a new ref, `<old-value>` is 40 `0`.
272
273If the hook exits with non-zero status, none of the refs will be
274updated. If the hook exits with zero, updating of individual refs can
275still be prevented by the <<update,'update'>> hook.
276
24a0d61e 277Both standard output and standard error output are forwarded to
9dba84d8 278`git send-pack` on the other end, so you can simply `echo` messages
24a0d61e 279for the user.
cbb84e5d 280
77a9745d
SB
281The number of push options given on the command line of
282`git push --push-option=...` can be read from the environment
283variable `GIT_PUSH_OPTION_COUNT`, and the options themselves are
284found in `GIT_PUSH_OPTION_0`, `GIT_PUSH_OPTION_1`,...
285If it is negotiated to not use the push options phase, the
286environment variables will not be set. If the client selects
287to use push options, but doesn't transmit any, the count variable
288will be set to zero, `GIT_PUSH_OPTION_COUNT=0`.
289
eaeed077
JK
290See the section on "Quarantine Environment" in
291linkgit:git-receive-pack[1] for some caveats.
292
cbb84e5d 293[[update]]
6d35cc76 294update
6d71c1dc 295~~~~~~
6d35cc76 296
9dba84d8
AH
297This hook is invoked by linkgit:git-receive-pack[1] when it reacts to
298`git push` and updates reference(s) in its repository.
6250ad1e 299Just before updating the ref on the remote repository, the update hook
37425065 300is invoked. Its exit status determines the success or failure of
6250ad1e
JL
301the ref update.
302
303The hook executes once for each ref to be updated, and takes
304three parameters:
45ad9b50
JF
305
306 - the name of the ref being updated,
307 - the old object name stored in the ref,
5fe8f49b 308 - and the new object name to be stored in the ref.
6250ad1e
JL
309
310A zero exit from the update hook allows the ref to be updated.
9dba84d8 311Exiting with a non-zero status prevents `git receive-pack`
cbb84e5d 312from updating that ref.
6250ad1e
JL
313
314This hook can be used to prevent 'forced' update on certain refs by
6d35cc76
JH
315making sure that the object name is a commit object that is a
316descendant of the commit object named by the old object name.
a75d7b54 317That is, to enforce a "fast-forward only" policy.
6250ad1e
JL
318
319It could also be used to log the old..new status. However, it
320does not know the entire set of branches, so it would end up
cbb84e5d
JH
321firing one e-mail per ref when used naively, though. The
322<<post-receive,'post-receive'>> hook is more suited to that.
6250ad1e 323
bf7d977f
ÆAB
324In an environment that restricts the users' access only to git
325commands over the wire, this hook can be used to implement access
326control without relying on filesystem ownership and group
327membership. See linkgit:git-shell[1] for how you might use the login
328shell to restrict the user's access to only git commands.
6d35cc76 329
24a0d61e 330Both standard output and standard error output are forwarded to
9dba84d8 331`git send-pack` on the other end, so you can simply `echo` messages
24a0d61e 332for the user.
3aadad1b 333
cbb84e5d 334The default 'update' hook, when enabled--and with
39c448c1 335`hooks.allowunannotated` config option unset or set to false--prevents
cbb84e5d
JH
336unannotated tags to be pushed.
337
338[[post-receive]]
339post-receive
6d71c1dc 340~~~~~~~~~~~~
6250ad1e 341
9dba84d8
AH
342This hook is invoked by linkgit:git-receive-pack[1] when it reacts to
343`git push` and updates reference(s) in its repository.
cbb84e5d
JH
344It executes on the remote repository once after all the refs have
345been updated.
346
347This hook executes once for the receive operation. It takes no
24a0d61e
JH
348arguments, but gets the same information as the
349<<pre-receive,'pre-receive'>>
cbb84e5d
JH
350hook does on its standard input.
351
9dba84d8 352This hook does not affect the outcome of `git receive-pack`, as it
cbb84e5d
JH
353is called after the real work is done.
354
02783075 355This supersedes the <<post-update,'post-update'>> hook in that it gets
24a0d61e
JH
356both old and new values of all the refs in addition to their
357names.
cbb84e5d 358
24a0d61e 359Both standard output and standard error output are forwarded to
9dba84d8 360`git send-pack` on the other end, so you can simply `echo` messages
24a0d61e 361for the user.
cbb84e5d
JH
362
363The default 'post-receive' hook is empty, but there is
364a sample script `post-receive-email` provided in the `contrib/hooks`
2de9b711 365directory in Git distribution, which implements sending commit
cbb84e5d
JH
366emails.
367
77a9745d
SB
368The number of push options given on the command line of
369`git push --push-option=...` can be read from the environment
370variable `GIT_PUSH_OPTION_COUNT`, and the options themselves are
371found in `GIT_PUSH_OPTION_0`, `GIT_PUSH_OPTION_1`,...
372If it is negotiated to not use the push options phase, the
373environment variables will not be set. If the client selects
374to use push options, but doesn't transmit any, the count variable
375will be set to zero, `GIT_PUSH_OPTION_COUNT=0`.
376
cbb84e5d 377[[post-update]]
6d35cc76 378post-update
6d71c1dc 379~~~~~~~~~~~
6d35cc76 380
9dba84d8
AH
381This hook is invoked by linkgit:git-receive-pack[1] when it reacts to
382`git push` and updates reference(s) in its repository.
6250ad1e
JL
383It executes on the remote repository once after all the refs have
384been updated.
385
386It takes a variable number of parameters, each of which is the
387name of ref that was actually updated.
6d35cc76
JH
388
389This hook is meant primarily for notification, and cannot affect
9dba84d8 390the outcome of `git receive-pack`.
6d35cc76 391
45ad9b50 392The 'post-update' hook can tell what are the heads that were pushed,
6250ad1e 393but it does not know what their original and updated values are,
24a0d61e
JH
394so it is a poor place to do log old..new. The
395<<post-receive,'post-receive'>> hook does get both original and
396updated values of the refs. You might consider it instead if you need
397them.
cbb84e5d 398
45ad9b50 399When enabled, the default 'post-update' hook runs
9dba84d8 400`git update-server-info` to keep the information used by dumb
7560f547 401transports (e.g., HTTP) up to date. If you are publishing
2de9b711 402a Git repository that is accessible via HTTP, you should
6250ad1e 403probably enable this hook.
3aadad1b 404
cbb84e5d 405Both standard output and standard error output are forwarded to
9dba84d8 406`git send-pack` on the other end, so you can simply `echo` messages
24a0d61e 407for the user.
0b85d926 408
6c18d03e
BC
409reference-transaction
410~~~~~~~~~~~~~~~~~~~~~
67541597
PS
411
412This hook is invoked by any Git command that performs reference
413updates. It executes whenever a reference transaction is prepared,
414committed or aborted and may thus get called multiple times.
415
416The hook takes exactly one argument, which is the current state the
417given reference transaction is in:
418
419 - "prepared": All reference updates have been queued to the
420 transaction and references were locked on disk.
421
422 - "committed": The reference transaction was committed and all
423 references now have their respective new value.
424
425 - "aborted": The reference transaction was aborted, no changes
426 were performed and the locks have been released.
427
428For each reference update that was added to the transaction, the hook
429receives on standard input a line of the format:
430
431 <old-value> SP <new-value> SP <ref-name> LF
432
433The exit status of the hook is ignored for any state except for the
434"prepared" state. In the "prepared" state, a non-zero exit status will
435cause the transaction to be aborted. The hook will not be called with
436"aborted" state in that case.
437
08553319
JH
438push-to-checkout
439~~~~~~~~~~~~~~~~
440
9dba84d8
AH
441This hook is invoked by linkgit:git-receive-pack[1] when it reacts to
442`git push` and updates reference(s) in its repository, and when
08553319
JH
443the push tries to update the branch that is currently checked out
444and the `receive.denyCurrentBranch` configuration variable is set to
445`updateInstead`. Such a push by default is refused if the working
446tree and the index of the remote repository has any difference from
447the currently checked out commit; when both the working tree and the
448index match the current commit, they are updated to match the newly
449pushed tip of the branch. This hook is to be used to override the
450default behaviour.
451
452The hook receives the commit with which the tip of the current
453branch is going to be updated. It can exit with a non-zero status
454to refuse the push (when it does so, it must not modify the index or
455the working tree). Or it can make any necessary changes to the
456working tree and to the index to bring them to the desired state
457when the tip of the current branch is updated to the new commit, and
458exit with a zero status.
459
460For example, the hook can simply run `git read-tree -u -m HEAD "$1"`
9dba84d8
AH
461in order to emulate `git fetch` that is run in the reverse direction
462with `git push`, as the two-tree form of `git read-tree -u -m` is
d787d311
NTND
463essentially the same as `git switch` or `git checkout`
464that switches branches while
08553319
JH
465keeping the local changes in the working tree that do not interfere
466with the difference between the branches.
467
468
0b85d926 469pre-auto-gc
6d71c1dc 470~~~~~~~~~~~
0b85d926 471
9dba84d8
AH
472This hook is invoked by `git gc --auto` (see linkgit:git-gc[1]). It
473takes no parameter, and exiting with non-zero status from this script
474causes the `git gc --auto` to abort.
a5af0e2c 475
c0fc6869
TR
476post-rewrite
477~~~~~~~~~~~~
478
9dba84d8
AH
479This hook is invoked by commands that rewrite commits
480(linkgit:git-commit[1] when called with `--amend` and
9df53c5d
EN
481linkgit:git-rebase[1]; however, full-history (re)writing tools like
482linkgit:git-fast-import[1] or
483https://github.com/newren/git-filter-repo[git-filter-repo] typically
484do not call it!). Its first argument denotes the command it was
485invoked by: currently one of `amend` or `rebase`. Further
486command-dependent arguments may be passed in the future.
c0fc6869
TR
487
488The hook receives a list of the rewritten commits on stdin, in the
489format
490
491 <old-sha1> SP <new-sha1> [ SP <extra-info> ] LF
492
493The 'extra-info' is again command-dependent. If it is empty, the
494preceding SP is also omitted. Currently, no commands pass any
495'extra-info'.
496
6956f858 497The hook always runs after the automatic note copying (see
ad52148a 498"notes.rewrite.<command>" in linkgit:git-config[1]) has happened, and
6956f858
TR
499thus has access to these notes.
500
c0fc6869
TR
501The following command-specific comments apply:
502
503rebase::
504 For the 'squash' and 'fixup' operation, all commits that were
505 squashed are listed as being rewritten to the squashed commit.
506 This means that there will be several lines sharing the same
507 'new-sha1'.
508+
509The commits are guaranteed to be listed in the order that they were
510processed by rebase.
511
6489660b
JT
512sendemail-validate
513~~~~~~~~~~~~~~~~~~
514
9dba84d8 515This hook is invoked by linkgit:git-send-email[1]. It takes a single parameter,
6489660b 516the name of the file that holds the e-mail to be sent. Exiting with a
9dba84d8 517non-zero status causes `git send-email` to abort before sending any
6489660b
JT
518e-mails.
519
780494b1
BP
520fsmonitor-watchman
521~~~~~~~~~~~~~~~~~~
522
9dba84d8 523This hook is invoked when the configuration option `core.fsmonitor` is
dfaed028
KW
524set to `.git/hooks/fsmonitor-watchman` or `.git/hooks/fsmonitor-watchmanv2`
525depending on the version of the hook to use.
526
527Version 1 takes two arguments, a version (1) and the time in elapsed
528nanoseconds since midnight, January 1, 1970.
529
530Version 2 takes two arguments, a version (2) and a token that is used
531for identifying changes since the token. For watchman this would be
532a clock id. This version must output to stdout the new token followed
533by a NUL before the list of files.
780494b1
BP
534
535The hook should output to stdout the list of all files in the working
536directory that may have changed since the requested time. The logic
537should be inclusive so that it does not miss any potential changes.
538The paths should be relative to the root of the working directory
539and be separated by a single NUL.
540
541It is OK to include files which have not actually changed. All changes
542including newly-created and deleted files should be included. When
543files are renamed, both the old and the new name should be included.
544
545Git will limit what files it checks for changes as well as which
546directories are checked for untracked files based on the path names
547given.
548
549An optimized way to tell git "all files have changed" is to return
9dba84d8 550the filename `/`.
780494b1
BP
551
552The exit status determines whether git will use the data from the
553hook to limit its search. On error, it will fall back to verifying
554all files and folders.
c0fc6869 555
38ecf752
BK
556p4-changelist
557~~~~~~~~~~~~~
558
559This hook is invoked by `git-p4 submit`.
560
561The `p4-changelist` hook is executed after the changelist
562message has been edited by the user. It can be bypassed with the
563`--no-verify` option. It takes a single parameter, the name
564of the file that holds the proposed changelist text. Exiting
565with a non-zero status causes the command to abort.
566
567The hook is allowed to edit the changelist file and can be used
568to normalize the text into some project standard format. It can
569also be used to refuse the Submit after inspect the message file.
570
571Run `git-p4 submit --help` for details.
572
573p4-prepare-changelist
574~~~~~~~~~~~~~~~~~~~~~
575
576This hook is invoked by `git-p4 submit`.
577
578The `p4-prepare-changelist` hook is executed right after preparing
579the default changelist message and before the editor is started.
580It takes one parameter, the name of the file that contains the
581changelist text. Exiting with a non-zero status from the script
582will abort the process.
583
584The purpose of the hook is to edit the message file in place,
585and it is not supressed by the `--no-verify` option. This hook
586is called even if `--prepare-p4-only` is set.
587
588Run `git-p4 submit --help` for details.
589
590p4-post-changelist
591~~~~~~~~~~~~~~~~~~
592
593This hook is invoked by `git-p4 submit`.
594
595The `p4-post-changelist` hook is invoked after the submit has
596successfully occured in P4. It takes no parameters and is meant
597primarily for notification and cannot affect the outcome of the
598git p4 submit action.
599
600Run `git-p4 submit --help` for details.
601
251c8c50
CB
602p4-pre-submit
603~~~~~~~~~~~~~
604
605This hook is invoked by `git-p4 submit`. It takes no parameters and nothing
606from standard input. Exiting with non-zero status from this script prevent
4935c458
BK
607`git-p4 submit` from launching. It can be bypassed with the `--no-verify`
608command line option. Run `git-p4 submit --help` for details.
609
610
251c8c50 611
1956ecd0
BP
612post-index-change
613~~~~~~~~~~~~~~~~~
614
615This hook is invoked when the index is written in read-cache.c
616do_write_locked_index.
617
618The first parameter passed to the hook is the indicator for the
619working directory being updated. "1" meaning working directory
620was updated or "0" when the working directory was not updated.
621
622The second parameter passed to the hook is the indicator for whether
623or not the index was updated and the skip-worktree bit could have
624changed. "1" meaning skip-worktree bits could have been updated
625and "0" meaning they were not.
626
627Only one parameter should be set to "1" when the hook runs. The hook
628running passing "1", "1" should not be possible.
629
a5af0e2c
CC
630GIT
631---
9e1f0a85 632Part of the linkgit:git[1] suite