Autogenerated HTML docs for v1.2.2-gc55f
[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.1" />\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>, which is invoked\r
346 when a <tt>git push</tt> is done against the repository.  It takes\r
347 three parameters, name of the ref being updated, old object name\r
348 stored in the ref, and the new objectname to be stored in the\r
349 ref.  Exiting with non-zero status from this hook prevents\r
350 <tt>git-receive-pack</tt> from updating the ref.</p>\r
351 <p>This can be used to prevent <em>forced</em> update on certain refs by\r
352 making sure that the object name is a commit object that is a\r
353 descendant of the commit object named by the old object name.\r
354 Another use suggested on the mailing list is to use this hook to\r
355 implement access control which is finer grained than the one\r
356 based on filesystem group.</p>\r
357 <p>The standard output of this hook is sent to /dev/null; if you\r
358 want to report something to the git-send-pack on the other end,\r
359 you can redirect your output to your stderr.</p>\r
360 </div>\r
361 <h2>post-update</h2>\r
362 <div class="sectionbody">\r
363 <p>This hook is invoked by <tt>git-receive-pack</tt>, which is invoked\r
364 when a <tt>git push</tt> is done against the repository.  It takes\r
365 variable number of parameters; each of which is the name of ref\r
366 that was actually updated.</p>\r
367 <p>This hook is meant primarily for notification, and cannot affect\r
368 the outcome of <tt>git-receive-pack</tt>.</p>\r
369 <p>The default post-update hook, when enabled, runs\r
370 <tt>git-update-server-info</tt> to keep the information used by dumb\r
371 transport up-to-date.</p>\r
372 <p>The standard output of this hook is sent to /dev/null; if you\r
373 want to report something to the git-send-pack on the other end,\r
374 you can redirect your output to your stderr.</p>\r
375 </div>\r
376 <div id="footer">\r
377 <div id="footer-text">\r
378 Last updated 27-Dec-2005 00:17:09 PDT\r
379 </div>\r
380 </div>\r
381 </body>\r
382 </html>\r