Autogenerated HTML docs for v1.3.1-g7464
[git.git] / hooks.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"\r
2     "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\r
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">\r
4 <head>\r
5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />\r
6 <meta name="generator" content="AsciiDoc 7.0.2" />\r
7 <style type="text/css">\r
8 /* Debug borders */\r
9 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {\r
10 /*\r
11   border: 1px solid red;\r
12 */\r
13 }\r
14 \r
15 body {\r
16   margin: 1em 5% 1em 5%;\r
17 }\r
18 \r
19 a { color: blue; }\r
20 a:visited { color: fuchsia; }\r
21 \r
22 em {\r
23   font-style: italic;\r
24 }\r
25 \r
26 strong {\r
27   font-weight: bold;\r
28 }\r
29 \r
30 tt {\r
31   color: navy;\r
32 }\r
33 \r
34 h1, h2, h3, h4, h5, h6 {\r
35   color: #527bbd;\r
36   font-family: sans-serif;\r
37   margin-top: 1.2em;\r
38   margin-bottom: 0.5em;\r
39   line-height: 1.3;\r
40 }\r
41 \r
42 h1 {\r
43   border-bottom: 2px solid silver;\r
44 }\r
45 h2 {\r
46   border-bottom: 2px solid silver;\r
47   padding-top: 0.5em;\r
48 }\r
49 \r
50 div.sectionbody {\r
51   font-family: serif;\r
52   margin-left: 0;\r
53 }\r
54 \r
55 hr {\r
56   border: 1px solid silver;\r
57 }\r
58 \r
59 p {\r
60   margin-top: 0.5em;\r
61   margin-bottom: 0.5em;\r
62 }\r
63 \r
64 pre {\r
65   padding: 0;\r
66   margin: 0;\r
67 }\r
68 \r
69 span#author {\r
70   color: #527bbd;\r
71   font-family: sans-serif;\r
72   font-weight: bold;\r
73   font-size: 1.2em;\r
74 }\r
75 span#email {\r
76 }\r
77 span#revision {\r
78   font-family: sans-serif;\r
79 }\r
80 \r
81 div#footer {\r
82   font-family: sans-serif;\r
83   font-size: small;\r
84   border-top: 2px solid silver;\r
85   padding-top: 0.5em;\r
86   margin-top: 4.0em;\r
87 }\r
88 div#footer-text {\r
89   float: left;\r
90   padding-bottom: 0.5em;\r
91 }\r
92 div#footer-badges {\r
93   float: right;\r
94   padding-bottom: 0.5em;\r
95 }\r
96 \r
97 div#preamble,\r
98 div.tableblock, div.imageblock, div.exampleblock, div.verseblock,\r
99 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,\r
100 div.admonitionblock {\r
101   margin-right: 10%;\r
102   margin-top: 1.5em;\r
103   margin-bottom: 1.5em;\r
104 }\r
105 div.admonitionblock {\r
106   margin-top: 2.5em;\r
107   margin-bottom: 2.5em;\r
108 }\r
109 \r
110 div.content { /* Block element content. */\r
111   padding: 0;\r
112 }\r
113 \r
114 /* Block element titles. */\r
115 div.title, caption.title {\r
116   font-family: sans-serif;\r
117   font-weight: bold;\r
118   text-align: left;\r
119   margin-top: 1.0em;\r
120   margin-bottom: 0.5em;\r
121 }\r
122 div.title + * {\r
123   margin-top: 0;\r
124 }\r
125 \r
126 td div.title:first-child {\r
127   margin-top: 0.0em;\r
128 }\r
129 div.content div.title:first-child {\r
130   margin-top: 0.0em;\r
131 }\r
132 div.content + div.title {\r
133   margin-top: 0.0em;\r
134 }\r
135 \r
136 div.sidebarblock > div.content {\r
137   background: #ffffee;\r
138   border: 1px solid silver;\r
139   padding: 0.5em;\r
140 }\r
141 \r
142 div.listingblock > div.content {\r
143   border: 1px solid silver;\r
144   background: #f4f4f4;\r
145   padding: 0.5em;\r
146 }\r
147 \r
148 div.quoteblock > div.content {\r
149   padding-left: 2.0em;\r
150 }\r
151 div.quoteblock .attribution {\r
152   text-align: right;\r
153 }\r
154 \r
155 div.admonitionblock .icon {\r
156   vertical-align: top;\r
157   font-size: 1.1em;\r
158   font-weight: bold;\r
159   text-decoration: underline;\r
160   color: #527bbd;\r
161   padding-right: 0.5em;\r
162 }\r
163 div.admonitionblock td.content {\r
164   padding-left: 0.5em;\r
165   border-left: 2px solid silver;\r
166 }\r
167 \r
168 div.exampleblock > div.content {\r
169   border-left: 2px solid silver;\r
170   padding: 0.5em;\r
171 }\r
172 \r
173 div.verseblock div.content {\r
174   white-space: pre;\r
175 }\r
176 \r
177 div.imageblock div.content { padding-left: 0; }\r
178 div.imageblock img { border: 1px solid silver; }\r
179 span.image img { border-style: none; }\r
180 \r
181 dl {\r
182   margin-top: 0.8em;\r
183   margin-bottom: 0.8em;\r
184 }\r
185 dt {\r
186   margin-top: 0.5em;\r
187   margin-bottom: 0;\r
188   font-style: italic;\r
189 }\r
190 dd > *:first-child {\r
191   margin-top: 0;\r
192 }\r
193 \r
194 ul, ol {\r
195     list-style-position: outside;\r
196 }\r
197 ol.olist2 {\r
198   list-style-type: lower-alpha;\r
199 }\r
200 \r
201 div.tableblock > table {\r
202   border-color: #527bbd;\r
203   border-width: 3px;\r
204 }\r
205 thead {\r
206   font-family: sans-serif;\r
207   font-weight: bold;\r
208 }\r
209 tfoot {\r
210   font-weight: bold;\r
211 }\r
212 \r
213 div.hlist {\r
214   margin-top: 0.8em;\r
215   margin-bottom: 0.8em;\r
216 }\r
217 td.hlist1 {\r
218   vertical-align: top;\r
219   font-style: italic;\r
220   padding-right: 0.8em;\r
221 }\r
222 td.hlist2 {\r
223   vertical-align: top;\r
224 }\r
225 \r
226 @media print {\r
227   div#footer-badges { display: none; }\r
228 }\r
229 /* Workarounds for IE6's broken and incomplete CSS2. */\r
230 \r
231 div.sidebar-content {\r
232   background: #ffffee;\r
233   border: 1px solid silver;\r
234   padding: 0.5em;\r
235 }\r
236 div.sidebar-title, div.image-title {\r
237   font-family: sans-serif;\r
238   font-weight: bold;\r
239   margin-top: 0.0em;\r
240   margin-bottom: 0.5em;\r
241 }\r
242 \r
243 div.listingblock div.content {\r
244   border: 1px solid silver;\r
245   background: #f4f4f4;\r
246   padding: 0.5em;\r
247 }\r
248 \r
249 div.quoteblock-content {\r
250   padding-left: 2.0em;\r
251 }\r
252 \r
253 div.exampleblock-content {\r
254   border-left: 2px solid silver;\r
255   padding-left: 0.5em;\r
256 }\r
257 </style>\r
258 <title>Hooks used by git</title>\r
259 </head>\r
260 <body>\r
261 <div id="header">\r
262 <h1>Hooks used by git</h1>\r
263 </div>\r
264 <div id="preamble">\r
265 <div class="sectionbody">\r
266 <p>Hooks are little scripts you can place in <tt>$GIT_DIR/hooks</tt>\r
267 directory to trigger action at certain points.  When\r
268 <tt>git-init-db</tt> is run, a handful example hooks are copied in the\r
269 <tt>hooks</tt> directory of the new repository, but by default they are\r
270 all disabled.  To enable a hook, make it executable with `chmod</p>\r
271 <p>+x`.</p>\r
272 <p>This document describes the currently defined hooks.</p>\r
273 </div>\r
274 </div>\r
275 <h2>applypatch-msg</h2>\r
276 <div class="sectionbody">\r
277 <p>This hook is invoked by <tt>git-applypatch</tt> script, which is\r
278 typically invoked by <tt>git-applymbox</tt>.  It takes a single\r
279 parameter, the name of the file that holds the proposed commit\r
280 log message.  Exiting with non-zero status causes the\r
281 <em>git-applypatch</em> to abort before applying the patch.</p>\r
282 <p>The hook is allowed to edit the message file in place, and can\r
283 be used to normalize the message into some project standard\r
284 format (if the project has one). It can also be used to refuse\r
285 the commit after inspecting the message file.</p>\r
286 <p>The default applypatch-msg hook, when enabled, runs the\r
287 commit-msg hook, if the latter is enabled.</p>\r
288 </div>\r
289 <h2>pre-applypatch</h2>\r
290 <div class="sectionbody">\r
291 <p>This hook is invoked by <tt>git-applypatch</tt> script, which is\r
292 typically invoked by <tt>git-applymbox</tt>.  It takes no parameter,\r
293 and is invoked after the patch is applied, but before a commit\r
294 is made.  Exiting with non-zero status causes the working tree\r
295 after application of the patch not committed.</p>\r
296 <p>It can be used to inspect the current working tree and refuse to\r
297 make a commit if it does not pass certain test.</p>\r
298 <p>The default pre-applypatch hook, when enabled, runs the\r
299 pre-commit hook, if the latter is enabled.</p>\r
300 </div>\r
301 <h2>post-applypatch</h2>\r
302 <div class="sectionbody">\r
303 <p>This hook is invoked by <tt>git-applypatch</tt> script, which is\r
304 typically invoked by <tt>git-applymbox</tt>.  It takes no parameter,\r
305 and is invoked after the patch is applied and a commit is made.</p>\r
306 <p>This hook is meant primarily for notification, and cannot affect\r
307 the outcome of <tt>git-applypatch</tt>.</p>\r
308 </div>\r
309 <h2>pre-commit</h2>\r
310 <div class="sectionbody">\r
311 <p>This hook is invoked by <tt>git-commit</tt>, and can be bypassed\r
312 with <tt>--no-verify</tt> option.  It takes no parameter, and is\r
313 invoked before obtaining the proposed commit log message and\r
314 making a commit.  Exiting with non-zero status from this script\r
315 causes the <tt>git-commit</tt> to abort.</p>\r
316 <p>The default pre-commit hook, when enabled, catches introduction\r
317 of lines with trailing whitespaces and aborts the commit when\r
318 a such line is found.</p>\r
319 </div>\r
320 <h2>commit-msg</h2>\r
321 <div class="sectionbody">\r
322 <p>This hook is invoked by <tt>git-commit</tt>, and can be bypassed\r
323 with <tt>--no-verify</tt> option.  It takes a single parameter, the\r
324 name of the file that holds the proposed commit log message.\r
325 Exiting with non-zero status causes the <tt>git-commit</tt> to\r
326 abort.</p>\r
327 <p>The hook is allowed to edit the message file in place, and can\r
328 be used to normalize the message into some project standard\r
329 format (if the project has one). It can also be used to refuse\r
330 the commit after inspecting the message file.</p>\r
331 <p>The default commit-msg hook, when enabled, detects duplicate\r
332 Signed-off-by: lines, and aborts the commit when one is found.</p>\r
333 </div>\r
334 <h2>post-commit</h2>\r
335 <div class="sectionbody">\r
336 <p>This hook is invoked by <tt>git-commit</tt>.  It takes no\r
337 parameter, and is invoked after a commit is made.</p>\r
338 <p>This hook is meant primarily for notification, and cannot affect\r
339 the outcome of <tt>git-commit</tt>.</p>\r
340 <p>The default post-commit hook, when enabled, demonstrates how to\r
341 send out a commit notification e-mail.</p>\r
342 </div>\r
343 <h2>update</h2>\r
344 <div class="sectionbody">\r
345 <p>This hook is invoked by <tt>git-receive-pack</tt> on the remote repository,\r
346 which is happens when a <tt>git push</tt> is done on a local repository.\r
347 Just before updating the ref on the remote repository, the update hook\r
348 is invoked.  It's exit status determins the success or failure of\r
349 the ref update.</p>\r
350 <p>The hook executes once for each ref to be updated, and takes\r
351 three parameters:\r
352     - the name of the ref being updated,\r
353     - the old object name stored in the ref,\r
354     - and the new objectname to be stored in the ref.</p>\r
355 <p>A zero exit from the update hook allows the ref to be updated.\r
356 Exiting with a non-zero status prevents <tt>git-receive-pack</tt>\r
357 from updating the ref.</p>\r
358 <p>This hook can be used to prevent <em>forced</em> update on certain refs by\r
359 making sure that the object name is a commit object that is a\r
360 descendant of the commit object named by the old object name.\r
361 That is, to enforce a "fast forward only" policy.</p>\r
362 <p>It could also be used to log the old..new status.  However, it\r
363 does not know the entire set of branches, so it would end up\r
364 firing one e-mail per ref when used naively, though.</p>\r
365 <p>Another use suggested on the mailing list is to use this hook to\r
366 implement access control which is finer grained than the one\r
367 based on filesystem group.</p>\r
368 <p>The standard output of this hook is sent to /dev/null; if you\r
369 want to report something to the git-send-pack on the other end,\r
370 you can redirect your output to your stderr.</p>\r
371 </div>\r
372 <h2>post-update</h2>\r
373 <div class="sectionbody">\r
374 <p>This hook is invoked by <tt>git-receive-pack</tt> on the remote repository,\r
375 which is happens when a <tt>git push</tt> is done on a local repository.\r
376 It executes on the remote repository once after all the refs have\r
377 been updated.</p>\r
378 <p>It takes a variable number of parameters, each of which is the\r
379 name of ref that was actually updated.</p>\r
380 <p>This hook is meant primarily for notification, and cannot affect\r
381 the outcome of <tt>git-receive-pack</tt>.</p>\r
382 <p>The post-update hook can tell what are the heads that were pushed,\r
383 but it does not know what their original and updated values are,\r
384 so it is a poor place to do log old..new.</p>\r
385 <p>The default post-update hook, when enabled, runs\r
386 <tt>git-update-server-info</tt> to keep the information used by dumb\r
387 transports (eg, http) up-to-date.  If you are publishing\r
388 a git repository that is accessible via http, you should\r
389 probably enable this hook.</p>\r
390 <p>The standard output of this hook is sent to /dev/null; if you\r
391 want to report something to the git-send-pack on the other end,\r
392 you can redirect your output to your stderr.</p>\r
393 </div>\r
394 <div id="footer">\r
395 <div id="footer-text">\r
396 Last updated 26-Mar-2006 01:49:03 UTC\r
397 </div>\r
398 </div>\r
399 </body>\r
400 </html>\r