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
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
9 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
\r
11 border: 1px solid red;
\r
16 margin: 1em 5% 1em 5%;
\r
20 a:visited { color: fuchsia; }
\r
34 h1, h2, h3, h4, h5, h6 {
\r
36 font-family: sans-serif;
\r
38 margin-bottom: 0.5em;
\r
43 border-bottom: 2px solid silver;
\r
46 border-bottom: 2px solid silver;
\r
56 border: 1px solid silver;
\r
61 margin-bottom: 0.5em;
\r
71 font-family: sans-serif;
\r
78 font-family: sans-serif;
\r
82 font-family: sans-serif;
\r
84 border-top: 2px solid silver;
\r
90 padding-bottom: 0.5em;
\r
94 padding-bottom: 0.5em;
\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
103 margin-bottom: 1.5em;
\r
105 div.admonitionblock {
\r
107 margin-bottom: 2.5em;
\r
110 div.content { /* Block element content. */
\r
114 /* Block element titles. */
\r
115 div.title, caption.title {
\r
116 font-family: sans-serif;
\r
120 margin-bottom: 0.5em;
\r
126 td div.title:first-child {
\r
129 div.content div.title:first-child {
\r
132 div.content + div.title {
\r
136 div.sidebarblock > div.content {
\r
137 background: #ffffee;
\r
138 border: 1px solid silver;
\r
142 div.listingblock > div.content {
\r
143 border: 1px solid silver;
\r
144 background: #f4f4f4;
\r
148 div.quoteblock > div.content {
\r
149 padding-left: 2.0em;
\r
151 div.quoteblock .attribution {
\r
155 div.admonitionblock .icon {
\r
156 vertical-align: top;
\r
159 text-decoration: underline;
\r
161 padding-right: 0.5em;
\r
163 div.admonitionblock td.content {
\r
164 padding-left: 0.5em;
\r
165 border-left: 2px solid silver;
\r
168 div.exampleblock > div.content {
\r
169 border-left: 2px solid silver;
\r
173 div.verseblock div.content {
\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
183 margin-bottom: 0.8em;
\r
188 font-style: italic;
\r
190 dd > *:first-child {
\r
195 list-style-position: outside;
\r
198 list-style-type: lower-alpha;
\r
201 div.tableblock > table {
\r
202 border-color: #527bbd;
\r
206 font-family: sans-serif;
\r
215 margin-bottom: 0.8em;
\r
218 vertical-align: top;
\r
219 font-style: italic;
\r
220 padding-right: 0.8em;
\r
223 vertical-align: top;
\r
227 div#footer-badges { display: none; }
\r
229 /* Workarounds for IE6's broken and incomplete CSS2. */
\r
231 div.sidebar-content {
\r
232 background: #ffffee;
\r
233 border: 1px solid silver;
\r
236 div.sidebar-title, div.image-title {
\r
237 font-family: sans-serif;
\r
240 margin-bottom: 0.5em;
\r
243 div.listingblock div.content {
\r
244 border: 1px solid silver;
\r
245 background: #f4f4f4;
\r
249 div.quoteblock-content {
\r
250 padding-left: 2.0em;
\r
253 div.exampleblock-content {
\r
254 border-left: 2px solid silver;
\r
255 padding-left: 0.5em;
\r
258 <title>Hooks used by git</title>
\r
262 <h1>Hooks used by git</h1>
\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
272 <p>This document describes the currently defined hooks.</p>
\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
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
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
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
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
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
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
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
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
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
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
395 <div id="footer-text">
\r
396 Last updated 26-Mar-2006 01:49:03 UTC
\r