@@ -31,7 +31,7 @@ Hooks can get their arguments via the environment, command-line
31
31
arguments, and stdin. See the documentation for each hook below for
32
32
details.
33
33
34
- ' git init' may copy hooks to the new repository, depending on its
34
+ ` git init` may copy hooks to the new repository, depending on its
35
35
configuration. See the "TEMPLATE DIRECTORY" section in
36
36
linkgit:git-init[1] for details. When the rest of this document refers
37
37
to "default hooks" it's talking about the default template shipped
45
45
applypatch-msg
46
46
~~~~~~~~~~~~~~
47
47
48
- This hook is invoked by ' git am' . It takes a single
48
+ This hook is invoked by linkgit: git-am[1] . It takes a single
49
49
parameter, the name of the file that holds the proposed commit
50
- log message. Exiting with a non-zero status causes ' git am' to abort
50
+ log message. Exiting with a non-zero status causes ` git am` to abort
51
51
before applying the patch.
52
52
53
53
The hook is allowed to edit the message file in place, and can
@@ -61,7 +61,7 @@ The default 'applypatch-msg' hook, when enabled, runs the
61
61
pre-applypatch
62
62
~~~~~~~~~~~~~~
63
63
64
- This hook is invoked by ' git am' . It takes no parameter, and is
64
+ This hook is invoked by linkgit: git-am[1] . It takes no parameter, and is
65
65
invoked after the patch is applied, but before a commit is made.
66
66
67
67
If it exits with non-zero status, then the working tree will not be
@@ -76,33 +76,33 @@ The default 'pre-applypatch' hook, when enabled, runs the
76
76
post-applypatch
77
77
~~~~~~~~~~~~~~~
78
78
79
- This hook is invoked by ' git am' . It takes no parameter,
79
+ This hook is invoked by linkgit: git-am[1] . It takes no parameter,
80
80
and is invoked after the patch is applied and a commit is made.
81
81
82
82
This hook is meant primarily for notification, and cannot affect
83
- the outcome of ' git am' .
83
+ the outcome of ` git am` .
84
84
85
85
pre-commit
86
86
~~~~~~~~~~
87
87
88
- This hook is invoked by ' git commit' , and can be bypassed
88
+ This hook is invoked by linkgit: git- commit[1] , and can be bypassed
89
89
with the `--no-verify` option. It takes no parameters, and is
90
90
invoked before obtaining the proposed commit log message and
91
91
making a commit. Exiting with a non-zero status from this script
92
- causes the ' git commit' command to abort before creating a commit.
92
+ causes the ` git commit` command to abort before creating a commit.
93
93
94
94
The default 'pre-commit' hook, when enabled, catches introduction
95
95
of lines with trailing whitespaces and aborts the commit when
96
96
such a line is found.
97
97
98
- All the ' git commit' hooks are invoked with the environment
98
+ All the ` git commit` hooks are invoked with the environment
99
99
variable `GIT_EDITOR=:` if the command will not bring up an editor
100
100
to modify the commit message.
101
101
102
102
prepare-commit-msg
103
103
~~~~~~~~~~~~~~~~~~
104
104
105
- This hook is invoked by ' git commit' right after preparing the
105
+ This hook is invoked by linkgit: git- commit[1] right after preparing the
106
106
default log message, and before the editor is started.
107
107
108
108
It takes one to three parameters. The first is the name of the file
@@ -114,7 +114,7 @@ commit is a merge or a `.git/MERGE_MSG` file exists); `squash`
114
114
(if a `.git/SQUASH_MSG` file exists); or `commit`, followed by
115
115
a commit SHA-1 (if a `-c`, `-C` or `--amend` option was given).
116
116
117
- If the exit status is non-zero, ' git commit' will abort.
117
+ If the exit status is non-zero, ` git commit` will abort.
118
118
119
119
The purpose of the hook is to edit the message file in place, and
120
120
it is not suppressed by the `--no-verify` option. A non-zero exit
@@ -127,7 +127,7 @@ help message found in the commented portion of the commit template.
127
127
commit-msg
128
128
~~~~~~~~~~
129
129
130
- This hook is invoked by ' git commit' and ' git merge' , and can be
130
+ This hook is invoked by linkgit: git- commit[1] and linkgit: git- merge[1] , and can be
131
131
bypassed with the `--no-verify` option. It takes a single parameter,
132
132
the name of the file that holds the proposed commit log message.
133
133
Exiting with a non-zero status causes the command to abort.
@@ -143,16 +143,16 @@ The default 'commit-msg' hook, when enabled, detects duplicate
143
143
post-commit
144
144
~~~~~~~~~~~
145
145
146
- This hook is invoked by ' git commit' . It takes no parameters, and is
146
+ This hook is invoked by linkgit: git- commit[1] . It takes no parameters, and is
147
147
invoked after a commit is made.
148
148
149
149
This hook is meant primarily for notification, and cannot affect
150
- the outcome of ' git commit' .
150
+ the outcome of ` git commit` .
151
151
152
152
pre-rebase
153
153
~~~~~~~~~~
154
154
155
- This hook is called by ' git rebase' and can be used to prevent a
155
+ This hook is called by linkgit: git- rebase[1] and can be used to prevent a
156
156
branch from getting rebased. The hook may be called with one or
157
157
two parameters. The first parameter is the upstream from which
158
158
the series was forked. The second parameter is the branch being
@@ -161,17 +161,17 @@ rebased, and is not set when rebasing the current branch.
161
161
post-checkout
162
162
~~~~~~~~~~~~~
163
163
164
- This hook is invoked when a ' git checkout' is run after having updated the
164
+ This hook is invoked when a linkgit: git- checkout[1] is run after having updated the
165
165
worktree. The hook is given three parameters: the ref of the previous HEAD,
166
166
the ref of the new HEAD (which may or may not have changed), and a flag
167
167
indicating whether the checkout was a branch checkout (changing branches,
168
168
flag=1) or a file checkout (retrieving a file from the index, flag=0).
169
- This hook cannot affect the outcome of ' git checkout' .
169
+ This hook cannot affect the outcome of ` git checkout` .
170
170
171
- It is also run after ' git clone' , unless the --no-checkout (-n ) option is
171
+ It is also run after linkgit: git- clone[1] , unless the ` --no-checkout` (`-n` ) option is
172
172
used. The first parameter given to the hook is the null-ref, the second the
173
- ref of the new HEAD and the flag is always 1. Likewise for ' git worktree add'
174
- unless --no-checkout is used.
173
+ ref of the new HEAD and the flag is always 1. Likewise for ` git worktree add`
174
+ unless ` --no-checkout` is used.
175
175
176
176
This hook can be used to perform repository validity checks, auto-display
177
177
differences from the previous HEAD if different, or set working dir metadata
@@ -180,10 +180,10 @@ properties.
180
180
post-merge
181
181
~~~~~~~~~~
182
182
183
- This hook is invoked by ' git merge' , which happens when a ' git pull'
183
+ This hook is invoked by linkgit: git- merge[1] , which happens when a ` git pull`
184
184
is done on a local repository. The hook takes a single parameter, a status
185
185
flag specifying whether or not the merge being done was a squash merge.
186
- This hook cannot affect the outcome of ' git merge' and is not executed,
186
+ This hook cannot affect the outcome of ` git merge` and is not executed,
187
187
if the merge failed due to conflicts.
188
188
189
189
This hook can be used in conjunction with a corresponding pre-commit hook to
@@ -194,10 +194,10 @@ for an example of how to do this.
194
194
pre-push
195
195
~~~~~~~~
196
196
197
- This hook is called by ' git push' and can be used to prevent a push from taking
198
- place. The hook is called with two parameters which provide the name and
199
- location of the destination remote, if a named remote is not being used both
200
- values will be the same.
197
+ This hook is called by linkgit: git- push[1] and can be used to prevent
198
+ a push from taking place. The hook is called with two parameters
199
+ which provide the name and location of the destination remote, if a
200
+ named remote is not being used both values will be the same.
201
201
202
202
Information about what is to be pushed is provided on the hook's standard
203
203
input with lines of the form:
@@ -216,16 +216,16 @@ SHA-1>` will be 40 `0`. If the local commit was specified by something other
216
216
than a name which could be expanded (such as `HEAD~`, or a SHA-1) it will be
217
217
supplied as it was originally given.
218
218
219
- If this hook exits with a non-zero status, ' git push' will abort without
219
+ If this hook exits with a non-zero status, ` git push` will abort without
220
220
pushing anything. Information about why the push is rejected may be sent
221
221
to the user by writing to standard error.
222
222
223
223
[[pre-receive]]
224
224
pre-receive
225
225
~~~~~~~~~~~
226
226
227
- This hook is invoked by ' git-receive-pack' when it reacts to
228
- ' git push' and updates reference(s) in its repository.
227
+ This hook is invoked by linkgit: git-receive-pack[1] when it reacts to
228
+ ` git push` and updates reference(s) in its repository.
229
229
Just before starting to update refs on the remote repository, the
230
230
pre-receive hook is invoked. Its exit status determines the success
231
231
or failure of the update.
@@ -246,7 +246,7 @@ updated. If the hook exits with zero, updating of individual refs can
246
246
still be prevented by the <<update,'update'>> hook.
247
247
248
248
Both standard output and standard error output are forwarded to
249
- ' git send-pack' on the other end, so you can simply `echo` messages
249
+ ` git send-pack` on the other end, so you can simply `echo` messages
250
250
for the user.
251
251
252
252
The number of push options given on the command line of
@@ -265,8 +265,8 @@ linkgit:git-receive-pack[1] for some caveats.
265
265
update
266
266
~~~~~~
267
267
268
- This hook is invoked by ' git-receive-pack' when it reacts to
269
- ' git push' and updates reference(s) in its repository.
268
+ This hook is invoked by linkgit: git-receive-pack[1] when it reacts to
269
+ ` git push` and updates reference(s) in its repository.
270
270
Just before updating the ref on the remote repository, the update hook
271
271
is invoked. Its exit status determines the success or failure of
272
272
the ref update.
@@ -279,7 +279,7 @@ three parameters:
279
279
- and the new object name to be stored in the ref.
280
280
281
281
A zero exit from the update hook allows the ref to be updated.
282
- Exiting with a non-zero status prevents ' git- receive-pack'
282
+ Exiting with a non-zero status prevents ` git receive-pack`
283
283
from updating that ref.
284
284
285
285
This hook can be used to prevent 'forced' update on certain refs by
@@ -299,7 +299,7 @@ membership. See linkgit:git-shell[1] for how you might use the login
299
299
shell to restrict the user's access to only git commands.
300
300
301
301
Both standard output and standard error output are forwarded to
302
- ' git send-pack' on the other end, so you can simply `echo` messages
302
+ ` git send-pack` on the other end, so you can simply `echo` messages
303
303
for the user.
304
304
305
305
The default 'update' hook, when enabled--and with
@@ -310,8 +310,8 @@ unannotated tags to be pushed.
310
310
post-receive
311
311
~~~~~~~~~~~~
312
312
313
- This hook is invoked by ' git-receive-pack' when it reacts to
314
- ' git push' and updates reference(s) in its repository.
313
+ This hook is invoked by linkgit: git-receive-pack[1] when it reacts to
314
+ ` git push` and updates reference(s) in its repository.
315
315
It executes on the remote repository once after all the refs have
316
316
been updated.
317
317
@@ -320,15 +320,15 @@ arguments, but gets the same information as the
320
320
<<pre-receive,'pre-receive'>>
321
321
hook does on its standard input.
322
322
323
- This hook does not affect the outcome of ' git- receive-pack' , as it
323
+ This hook does not affect the outcome of ` git receive-pack` , as it
324
324
is called after the real work is done.
325
325
326
326
This supersedes the <<post-update,'post-update'>> hook in that it gets
327
327
both old and new values of all the refs in addition to their
328
328
names.
329
329
330
330
Both standard output and standard error output are forwarded to
331
- ' git send-pack' on the other end, so you can simply `echo` messages
331
+ ` git send-pack` on the other end, so you can simply `echo` messages
332
332
for the user.
333
333
334
334
The default 'post-receive' hook is empty, but there is
@@ -349,16 +349,16 @@ will be set to zero, `GIT_PUSH_OPTION_COUNT=0`.
349
349
post-update
350
350
~~~~~~~~~~~
351
351
352
- This hook is invoked by ' git-receive-pack' when it reacts to
353
- ' git push' and updates reference(s) in its repository.
352
+ This hook is invoked by linkgit: git-receive-pack[1] when it reacts to
353
+ ` git push` and updates reference(s) in its repository.
354
354
It executes on the remote repository once after all the refs have
355
355
been updated.
356
356
357
357
It takes a variable number of parameters, each of which is the
358
358
name of ref that was actually updated.
359
359
360
360
This hook is meant primarily for notification, and cannot affect
361
- the outcome of ' git- receive-pack' .
361
+ the outcome of ` git receive-pack` .
362
362
363
363
The 'post-update' hook can tell what are the heads that were pushed,
364
364
but it does not know what their original and updated values are,
@@ -368,20 +368,20 @@ updated values of the refs. You might consider it instead if you need
368
368
them.
369
369
370
370
When enabled, the default 'post-update' hook runs
371
- ' git update-server-info' to keep the information used by dumb
371
+ ` git update-server-info` to keep the information used by dumb
372
372
transports (e.g., HTTP) up to date. If you are publishing
373
373
a Git repository that is accessible via HTTP, you should
374
374
probably enable this hook.
375
375
376
376
Both standard output and standard error output are forwarded to
377
- ' git send-pack' on the other end, so you can simply `echo` messages
377
+ ` git send-pack` on the other end, so you can simply `echo` messages
378
378
for the user.
379
379
380
380
push-to-checkout
381
381
~~~~~~~~~~~~~~~~
382
382
383
- This hook is invoked by ' git-receive-pack' when it reacts to
384
- ' git push' and updates reference(s) in its repository, and when
383
+ This hook is invoked by linkgit: git-receive-pack[1] when it reacts to
384
+ ` git push` and updates reference(s) in its repository, and when
385
385
the push tries to update the branch that is currently checked out
386
386
and the `receive.denyCurrentBranch` configuration variable is set to
387
387
`updateInstead`. Such a push by default is refused if the working
@@ -400,8 +400,8 @@ when the tip of the current branch is updated to the new commit, and
400
400
exit with a zero status.
401
401
402
402
For example, the hook can simply run `git read-tree -u -m HEAD "$1"`
403
- in order to emulate ' git fetch' that is run in the reverse direction
404
- with `git push`, as the two-tree form of `read-tree -u -m` is
403
+ in order to emulate ` git fetch` that is run in the reverse direction
404
+ with `git push`, as the two-tree form of `git read-tree -u -m` is
405
405
essentially the same as `git checkout` that switches branches while
406
406
keeping the local changes in the working tree that do not interfere
407
407
with the difference between the branches.
@@ -410,15 +410,16 @@ with the difference between the branches.
410
410
pre-auto-gc
411
411
~~~~~~~~~~~
412
412
413
- This hook is invoked by ' git gc --auto'. It takes no parameter, and
414
- exiting with non-zero status from this script causes the 'git gc --auto'
415
- to abort.
413
+ This hook is invoked by ` git gc --auto` (see linkgit:git-gc[1]). It
414
+ takes no parameter, and exiting with non-zero status from this script
415
+ causes the `git gc --auto` to abort.
416
416
417
417
post-rewrite
418
418
~~~~~~~~~~~~
419
419
420
- This hook is invoked by commands that rewrite commits (`git commit
421
- --amend`, 'git-rebase'; currently 'git-filter-branch' does 'not' call
420
+ This hook is invoked by commands that rewrite commits
421
+ (linkgit:git-commit[1] when called with `--amend` and
422
+ linkgit:git-rebase[1]; currently `git filter-branch` does 'not' call
422
423
it!). Its first argument denotes the command it was invoked by:
423
424
currently one of `amend` or `rebase`. Further command-dependent
424
425
arguments may be passed in the future.
@@ -450,16 +451,16 @@ processed by rebase.
450
451
sendemail-validate
451
452
~~~~~~~~~~~~~~~~~~
452
453
453
- This hook is invoked by ' git send-email' . It takes a single parameter,
454
+ This hook is invoked by linkgit: git- send-email[1] . It takes a single parameter,
454
455
the name of the file that holds the e-mail to be sent. Exiting with a
455
- non-zero status causes ' git send-email' to abort before sending any
456
+ non-zero status causes ` git send-email` to abort before sending any
456
457
e-mails.
457
458
458
459
fsmonitor-watchman
459
460
~~~~~~~~~~~~~~~~~~
460
461
461
- This hook is invoked when the configuration option core.fsmonitor is
462
- set to .git/hooks/fsmonitor-watchman. It takes two arguments, a version
462
+ This hook is invoked when the configuration option ` core.fsmonitor` is
463
+ set to ` .git/hooks/fsmonitor-watchman` . It takes two arguments, a version
463
464
(currently 1) and the time in elapsed nanoseconds since midnight,
464
465
January 1, 1970.
465
466
@@ -478,7 +479,7 @@ directories are checked for untracked files based on the path names
478
479
given.
479
480
480
481
An optimized way to tell git "all files have changed" is to return
481
- the filename '/' .
482
+ the filename `/` .
482
483
483
484
The exit status determines whether git will use the data from the
484
485
hook to limit its search. On error, it will fall back to verifying
0 commit comments