<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" | |
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<meta name="generator" content="AsciiDoc 7.0.2" /> | |
<style type="text/css"> | |
/* Debug borders */ | |
p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 { | |
/* | |
border: 1px solid red; | |
*/ | |
} | |
body { | |
margin: 1em 5% 1em 5%; | |
} | |
a { color: blue; } | |
a:visited { color: fuchsia; } | |
em { | |
font-style: italic; | |
} | |
strong { | |
font-weight: bold; | |
} | |
tt { | |
color: navy; | |
} | |
h1, h2, h3, h4, h5, h6 { | |
color: #527bbd; | |
font-family: sans-serif; | |
margin-top: 1.2em; | |
margin-bottom: 0.5em; | |
line-height: 1.3; | |
} | |
h1 { | |
border-bottom: 2px solid silver; | |
} | |
h2 { | |
border-bottom: 2px solid silver; | |
padding-top: 0.5em; | |
} | |
div.sectionbody { | |
font-family: serif; | |
margin-left: 0; | |
} | |
hr { | |
border: 1px solid silver; | |
} | |
p { | |
margin-top: 0.5em; | |
margin-bottom: 0.5em; | |
} | |
pre { | |
padding: 0; | |
margin: 0; | |
} | |
span#author { | |
color: #527bbd; | |
font-family: sans-serif; | |
font-weight: bold; | |
font-size: 1.2em; | |
} | |
span#email { | |
} | |
span#revision { | |
font-family: sans-serif; | |
} | |
div#footer { | |
font-family: sans-serif; | |
font-size: small; | |
border-top: 2px solid silver; | |
padding-top: 0.5em; | |
margin-top: 4.0em; | |
} | |
div#footer-text { | |
float: left; | |
padding-bottom: 0.5em; | |
} | |
div#footer-badges { | |
float: right; | |
padding-bottom: 0.5em; | |
} | |
div#preamble, | |
div.tableblock, div.imageblock, div.exampleblock, div.verseblock, | |
div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock, | |
div.admonitionblock { | |
margin-right: 10%; | |
margin-top: 1.5em; | |
margin-bottom: 1.5em; | |
} | |
div.admonitionblock { | |
margin-top: 2.5em; | |
margin-bottom: 2.5em; | |
} | |
div.content { /* Block element content. */ | |
padding: 0; | |
} | |
/* Block element titles. */ | |
div.title, caption.title { | |
font-family: sans-serif; | |
font-weight: bold; | |
text-align: left; | |
margin-top: 1.0em; | |
margin-bottom: 0.5em; | |
} | |
div.title + * { | |
margin-top: 0; | |
} | |
td div.title:first-child { | |
margin-top: 0.0em; | |
} | |
div.content div.title:first-child { | |
margin-top: 0.0em; | |
} | |
div.content + div.title { | |
margin-top: 0.0em; | |
} | |
div.sidebarblock > div.content { | |
background: #ffffee; | |
border: 1px solid silver; | |
padding: 0.5em; | |
} | |
div.listingblock > div.content { | |
border: 1px solid silver; | |
background: #f4f4f4; | |
padding: 0.5em; | |
} | |
div.quoteblock > div.content { | |
padding-left: 2.0em; | |
} | |
div.quoteblock .attribution { | |
text-align: right; | |
} | |
div.admonitionblock .icon { | |
vertical-align: top; | |
font-size: 1.1em; | |
font-weight: bold; | |
text-decoration: underline; | |
color: #527bbd; | |
padding-right: 0.5em; | |
} | |
div.admonitionblock td.content { | |
padding-left: 0.5em; | |
border-left: 2px solid silver; | |
} | |
div.exampleblock > div.content { | |
border-left: 2px solid silver; | |
padding: 0.5em; | |
} | |
div.verseblock div.content { | |
white-space: pre; | |
} | |
div.imageblock div.content { padding-left: 0; } | |
div.imageblock img { border: 1px solid silver; } | |
span.image img { border-style: none; } | |
dl { | |
margin-top: 0.8em; | |
margin-bottom: 0.8em; | |
} | |
dt { | |
margin-top: 0.5em; | |
margin-bottom: 0; | |
font-style: italic; | |
} | |
dd > *:first-child { | |
margin-top: 0; | |
} | |
ul, ol { | |
list-style-position: outside; | |
} | |
ol.olist2 { | |
list-style-type: lower-alpha; | |
} | |
div.tableblock > table { | |
border-color: #527bbd; | |
border-width: 3px; | |
} | |
thead { | |
font-family: sans-serif; | |
font-weight: bold; | |
} | |
tfoot { | |
font-weight: bold; | |
} | |
div.hlist { | |
margin-top: 0.8em; | |
margin-bottom: 0.8em; | |
} | |
td.hlist1 { | |
vertical-align: top; | |
font-style: italic; | |
padding-right: 0.8em; | |
} | |
td.hlist2 { | |
vertical-align: top; | |
} | |
@media print { | |
div#footer-badges { display: none; } | |
} | |
/* Workarounds for IE6's broken and incomplete CSS2. */ | |
div.sidebar-content { | |
background: #ffffee; | |
border: 1px solid silver; | |
padding: 0.5em; | |
} | |
div.sidebar-title, div.image-title { | |
font-family: sans-serif; | |
font-weight: bold; | |
margin-top: 0.0em; | |
margin-bottom: 0.5em; | |
} | |
div.listingblock div.content { | |
border: 1px solid silver; | |
background: #f4f4f4; | |
padding: 0.5em; | |
} | |
div.quoteblock-content { | |
padding-left: 2.0em; | |
} | |
div.exampleblock-content { | |
border-left: 2px solid silver; | |
padding-left: 0.5em; | |
} | |
</style> | |
<title>Hooks used by git</title> | |
</head> | |
<body> | |
<div id="header"> | |
<h1>Hooks used by git</h1> | |
</div> | |
<div id="preamble"> | |
<div class="sectionbody"> | |
<p>Hooks are little scripts you can place in <tt>$GIT_DIR/hooks</tt> | |
directory to trigger action at certain points. When | |
<tt>git-init-db</tt> is run, a handful example hooks are copied in the | |
<tt>hooks</tt> directory of the new repository, but by default they are | |
all disabled. To enable a hook, make it executable with `chmod</p> | |
<p>+x`.</p> | |
<p>This document describes the currently defined hooks.</p> | |
</div> | |
</div> | |
<h2>applypatch-msg</h2> | |
<div class="sectionbody"> | |
<p>This hook is invoked by <tt>git-applypatch</tt> script, which is | |
typically invoked by <tt>git-applymbox</tt>. It takes a single | |
parameter, the name of the file that holds the proposed commit | |
log message. Exiting with non-zero status causes the | |
<em>git-applypatch</em> to abort before applying the patch.</p> | |
<p>The hook is allowed to edit the message file in place, and can | |
be used to normalize the message into some project standard | |
format (if the project has one). It can also be used to refuse | |
the commit after inspecting the message file.</p> | |
<p>The default applypatch-msg hook, when enabled, runs the | |
commit-msg hook, if the latter is enabled.</p> | |
</div> | |
<h2>pre-applypatch</h2> | |
<div class="sectionbody"> | |
<p>This hook is invoked by <tt>git-applypatch</tt> script, which is | |
typically invoked by <tt>git-applymbox</tt>. It takes no parameter, | |
and is invoked after the patch is applied, but before a commit | |
is made. Exiting with non-zero status causes the working tree | |
after application of the patch not committed.</p> | |
<p>It can be used to inspect the current working tree and refuse to | |
make a commit if it does not pass certain test.</p> | |
<p>The default pre-applypatch hook, when enabled, runs the | |
pre-commit hook, if the latter is enabled.</p> | |
</div> | |
<h2>post-applypatch</h2> | |
<div class="sectionbody"> | |
<p>This hook is invoked by <tt>git-applypatch</tt> script, which is | |
typically invoked by <tt>git-applymbox</tt>. It takes no parameter, | |
and is invoked after the patch is applied and a commit is made.</p> | |
<p>This hook is meant primarily for notification, and cannot affect | |
the outcome of <tt>git-applypatch</tt>.</p> | |
</div> | |
<h2>pre-commit</h2> | |
<div class="sectionbody"> | |
<p>This hook is invoked by <tt>git-commit</tt>, and can be bypassed | |
with <tt>--no-verify</tt> option. It takes no parameter, and is | |
invoked before obtaining the proposed commit log message and | |
making a commit. Exiting with non-zero status from this script | |
causes the <tt>git-commit</tt> to abort.</p> | |
<p>The default pre-commit hook, when enabled, catches introduction | |
of lines with trailing whitespaces and aborts the commit when | |
a such line is found.</p> | |
</div> | |
<h2>commit-msg</h2> | |
<div class="sectionbody"> | |
<p>This hook is invoked by <tt>git-commit</tt>, and can be bypassed | |
with <tt>--no-verify</tt> option. It takes a single parameter, the | |
name of the file that holds the proposed commit log message. | |
Exiting with non-zero status causes the <tt>git-commit</tt> to | |
abort.</p> | |
<p>The hook is allowed to edit the message file in place, and can | |
be used to normalize the message into some project standard | |
format (if the project has one). It can also be used to refuse | |
the commit after inspecting the message file.</p> | |
<p>The default commit-msg hook, when enabled, detects duplicate | |
Signed-off-by: lines, and aborts the commit when one is found.</p> | |
</div> | |
<h2>post-commit</h2> | |
<div class="sectionbody"> | |
<p>This hook is invoked by <tt>git-commit</tt>. It takes no | |
parameter, and is invoked after a commit is made.</p> | |
<p>This hook is meant primarily for notification, and cannot affect | |
the outcome of <tt>git-commit</tt>.</p> | |
<p>The default post-commit hook, when enabled, demonstrates how to | |
send out a commit notification e-mail.</p> | |
</div> | |
<h2>update</h2> | |
<div class="sectionbody"> | |
<p>This hook is invoked by <tt>git-receive-pack</tt> on the remote repository, | |
which is happens when a <tt>git push</tt> is done on a local repository. | |
Just before updating the ref on the remote repository, the update hook | |
is invoked. It's exit status determins the success or failure of | |
the ref update.</p> | |
<p>The hook executes once for each ref to be updated, and takes | |
three parameters: | |
- the name of the ref being updated, | |
- the old object name stored in the ref, | |
- and the new objectname to be stored in the ref.</p> | |
<p>A zero exit from the update hook allows the ref to be updated. | |
Exiting with a non-zero status prevents <tt>git-receive-pack</tt> | |
from updating the ref.</p> | |
<p>This hook can be used to prevent <em>forced</em> update on certain refs by | |
making sure that the object name is a commit object that is a | |
descendant of the commit object named by the old object name. | |
That is, to enforce a "fast forward only" policy.</p> | |
<p>It could also be used to log the old..new status. However, it | |
does not know the entire set of branches, so it would end up | |
firing one e-mail per ref when used naively, though.</p> | |
<p>Another use suggested on the mailing list is to use this hook to | |
implement access control which is finer grained than the one | |
based on filesystem group.</p> | |
<p>The standard output of this hook is sent to /dev/null; if you | |
want to report something to the git-send-pack on the other end, | |
you can redirect your output to your stderr.</p> | |
</div> | |
<h2>post-update</h2> | |
<div class="sectionbody"> | |
<p>This hook is invoked by <tt>git-receive-pack</tt> on the remote repository, | |
which is happens when a <tt>git push</tt> is done on a local repository. | |
It executes on the remote repository once after all the refs have | |
been updated.</p> | |
<p>It takes a variable number of parameters, each of which is the | |
name of ref that was actually updated.</p> | |
<p>This hook is meant primarily for notification, and cannot affect | |
the outcome of <tt>git-receive-pack</tt>.</p> | |
<p>The post-update hook can tell what are the heads that were pushed, | |
but it does not know what their original and updated values are, | |
so it is a poor place to do log old..new.</p> | |
<p>The default post-update hook, when enabled, runs | |
<tt>git-update-server-info</tt> to keep the information used by dumb | |
transports (eg, http) up-to-date. If you are publishing | |
a git repository that is accessible via http, you should | |
probably enable this hook.</p> | |
<p>The standard output of this hook is sent to /dev/null; if you | |
want to report something to the git-send-pack on the other end, | |
you can redirect your output to your stderr.</p> | |
</div> | |
<div id="footer"> | |
<div id="footer-text"> | |
Last updated 26-Mar-2006 01:49:03 UTC | |
</div> | |
</div> | |
</body> | |
</html> |