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