blob: 6e52400dc97fcf3c73b90f65ee94e6e425cd349a [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Junio C Hamano97f518c2006-06-22 19:49:356<meta name="generator" content="AsciiDoc 7.0.2" />
Junio C Hamano1a4e8412005-12-27 08:17:237<style type="text/css">
8/* Debug borders */
9p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
10/*
11 border: 1px solid red;
12*/
13}
14
15body {
16 margin: 1em 5% 1em 5%;
17}
18
19a { color: blue; }
20a:visited { color: fuchsia; }
21
22em {
23 font-style: italic;
24}
25
26strong {
27 font-weight: bold;
28}
29
30tt {
31 color: navy;
32}
33
34h1, h2, h3, h4, h5, h6 {
35 color: #527bbd;
36 font-family: sans-serif;
37 margin-top: 1.2em;
38 margin-bottom: 0.5em;
39 line-height: 1.3;
40}
41
42h1 {
43 border-bottom: 2px solid silver;
44}
45h2 {
46 border-bottom: 2px solid silver;
47 padding-top: 0.5em;
48}
49
50div.sectionbody {
51 font-family: serif;
52 margin-left: 0;
53}
54
55hr {
56 border: 1px solid silver;
57}
58
59p {
60 margin-top: 0.5em;
61 margin-bottom: 0.5em;
62}
63
64pre {
65 padding: 0;
66 margin: 0;
67}
68
69span#author {
70 color: #527bbd;
71 font-family: sans-serif;
72 font-weight: bold;
73 font-size: 1.2em;
74}
75span#email {
76}
77span#revision {
78 font-family: sans-serif;
79}
80
81div#footer {
82 font-family: sans-serif;
83 font-size: small;
84 border-top: 2px solid silver;
85 padding-top: 0.5em;
86 margin-top: 4.0em;
87}
88div#footer-text {
89 float: left;
90 padding-bottom: 0.5em;
91}
92div#footer-badges {
93 float: right;
94 padding-bottom: 0.5em;
95}
96
97div#preamble,
98div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
99div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
100div.admonitionblock {
101 margin-right: 10%;
102 margin-top: 1.5em;
103 margin-bottom: 1.5em;
104}
105div.admonitionblock {
106 margin-top: 2.5em;
107 margin-bottom: 2.5em;
108}
109
110div.content { /* Block element content. */
111 padding: 0;
112}
113
114/* Block element titles. */
115div.title, caption.title {
116 font-family: sans-serif;
117 font-weight: bold;
118 text-align: left;
119 margin-top: 1.0em;
120 margin-bottom: 0.5em;
121}
122div.title + * {
123 margin-top: 0;
124}
125
126td div.title:first-child {
127 margin-top: 0.0em;
128}
129div.content div.title:first-child {
130 margin-top: 0.0em;
131}
132div.content + div.title {
133 margin-top: 0.0em;
134}
135
136div.sidebarblock > div.content {
137 background: #ffffee;
138 border: 1px solid silver;
139 padding: 0.5em;
140}
141
142div.listingblock > div.content {
143 border: 1px solid silver;
144 background: #f4f4f4;
145 padding: 0.5em;
146}
147
148div.quoteblock > div.content {
149 padding-left: 2.0em;
150}
151div.quoteblock .attribution {
152 text-align: right;
153}
154
155div.admonitionblock .icon {
156 vertical-align: top;
157 font-size: 1.1em;
158 font-weight: bold;
159 text-decoration: underline;
160 color: #527bbd;
161 padding-right: 0.5em;
162}
163div.admonitionblock td.content {
164 padding-left: 0.5em;
165 border-left: 2px solid silver;
166}
167
168div.exampleblock > div.content {
169 border-left: 2px solid silver;
170 padding: 0.5em;
171}
172
173div.verseblock div.content {
174 white-space: pre;
175}
176
177div.imageblock div.content { padding-left: 0; }
178div.imageblock img { border: 1px solid silver; }
179span.image img { border-style: none; }
180
181dl {
182 margin-top: 0.8em;
183 margin-bottom: 0.8em;
184}
185dt {
186 margin-top: 0.5em;
187 margin-bottom: 0;
188 font-style: italic;
189}
190dd > *:first-child {
191 margin-top: 0;
192}
193
194ul, ol {
195 list-style-position: outside;
196}
197ol.olist2 {
198 list-style-type: lower-alpha;
199}
200
201div.tableblock > table {
202 border-color: #527bbd;
203 border-width: 3px;
204}
205thead {
206 font-family: sans-serif;
207 font-weight: bold;
208}
209tfoot {
210 font-weight: bold;
211}
212
213div.hlist {
214 margin-top: 0.8em;
215 margin-bottom: 0.8em;
216}
217td.hlist1 {
218 vertical-align: top;
219 font-style: italic;
220 padding-right: 0.8em;
221}
222td.hlist2 {
223 vertical-align: top;
224}
225
226@media print {
227 div#footer-badges { display: none; }
228}
229include::./stylesheets/xhtml11-manpage.css[]
230/* Workarounds for IE6's broken and incomplete CSS2. */
231
232div.sidebar-content {
233 background: #ffffee;
234 border: 1px solid silver;
235 padding: 0.5em;
236}
237div.sidebar-title, div.image-title {
238 font-family: sans-serif;
239 font-weight: bold;
240 margin-top: 0.0em;
241 margin-bottom: 0.5em;
242}
243
244div.listingblock div.content {
245 border: 1px solid silver;
246 background: #f4f4f4;
247 padding: 0.5em;
248}
249
250div.quoteblock-content {
251 padding-left: 2.0em;
252}
253
254div.exampleblock-content {
255 border-left: 2px solid silver;
256 padding-left: 0.5em;
257}
258</style>
259<title>git-receive-pack(1)</title>
260</head>
261<body>
262<div id="header">
263<h1>
264git-receive-pack(1) Manual Page
265</h1>
266<h2>NAME</h2>
267<div class="sectionbody">
268<p>git-receive-pack -
Junio C Hamano7c73c662007-01-19 00:37:50269 Receive what is pushed into the repository
Junio C Hamano1a4e8412005-12-27 08:17:23270</p>
271</div>
272</div>
273<h2>SYNOPSIS</h2>
274<div class="sectionbody">
275<p><em>git-receive-pack</em> &lt;directory&gt;</p>
276</div>
277<h2>DESCRIPTION</h2>
278<div class="sectionbody">
279<p>Invoked by <em>git-send-pack</em> and updates the repository with the
280information fed from the remote end.</p>
281<p>This command is usually not invoked directly by the end user.
282The UI for the protocol is on the <em>git-send-pack</em> side, and the
283program pair is meant to be used to push updates to remote
Junio C Hamano97f518c2006-06-22 19:49:35284repository. For pull operations, see <em>git-fetch-pack</em>.</p>
Junio C Hamano1a4e8412005-12-27 08:17:23285<p>The command allows for creation and fast forwarding of sha1 refs
286(heads/tags) on the remote end (strictly speaking, it is the
287local end receive-pack runs, but to the user who is sitting at
288the send-pack end, it is updating the remote. Confused?)</p>
Junio C Hamano1a4e8412005-12-27 08:17:23289<p>There are other real-world examples of using update and
290post-update hooks found in the Documentation/howto directory.</p>
Junio C Hamanoabcd65d2007-03-08 02:43:00291<p>git-receive-pack honours the receive.denyNonFastForwards config
292option, which tells it if updates to a ref should be denied if they
293are not fast-forwards.</p>
Junio C Hamano1a4e8412005-12-27 08:17:23294</div>
295<h2>OPTIONS</h2>
296<div class="sectionbody">
297<dl>
298<dt>
299&lt;directory&gt;
300</dt>
301<dd>
302<p>
303 The repository to sync into.
304</p>
305</dd>
306</dl>
307</div>
Junio C Hamanoabcd65d2007-03-08 02:43:00308<h2>pre-receive Hook</h2>
309<div class="sectionbody">
310<p>Before any ref is updated, if $GIT_DIR/hooks/pre-receive file exists
Junio C Hamanoc51fede2007-03-12 07:29:20311and is executable, it will be invoked once with no parameters. The
312standard input of the hook will be one line per ref to be updated:</p>
Junio C Hamanoabcd65d2007-03-08 02:43:00313<div class="literalblock">
314<div class="content">
Junio C Hamanoc51fede2007-03-12 07:29:20315<pre><tt>sha1-old SP sha1-new SP refname LF</tt></pre>
Junio C Hamanoabcd65d2007-03-08 02:43:00316</div></div>
Junio C Hamanoc51fede2007-03-12 07:29:20317<p>The refname value is relative to $GIT_DIR; e.g. for the master
318head this is "refs/heads/master". The two sha1 values before
Junio C Hamanoabcd65d2007-03-08 02:43:00319each refname are the object names for the refname before and after
Junio C Hamano1d90cb02007-07-03 07:05:31320the update. Refs to be created will have sha1-old equal to 0{40},
321while refs to be deleted will have sha1-new equal to 0{40}, otherwise
Junio C Hamanoabcd65d2007-03-08 02:43:00322sha1-old and sha1-new should be valid objects in the repository.</p>
323<p>This hook is called before any refname is updated and before any
324fast-forward checks are performed.</p>
325<p>If the pre-receive hook exits with a non-zero exit status no updates
326will be performed, and the update, post-receive and post-update
327hooks will not be invoked either. This can be useful to quickly
328bail out if the update is not to be supported.</p>
329</div>
330<h2>update Hook</h2>
331<div class="sectionbody">
332<p>Before each ref is updated, if $GIT_DIR/hooks/update file exists
333and is executable, it is invoked once per ref, with three parameters:</p>
334<div class="literalblock">
335<div class="content">
336<pre><tt>$GIT_DIR/hooks/update refname sha1-old sha1-new</tt></pre>
337</div></div>
338<p>The refname parameter is relative to $GIT_DIR; e.g. for the master
339head this is "refs/heads/master". The two sha1 arguments are
340the object names for the refname before and after the update.
341Note that the hook is called before the refname is updated,
Junio C Hamano1d90cb02007-07-03 07:05:31342so either sha1-old is 0{40} (meaning there is no such ref yet),
Junio C Hamanoabcd65d2007-03-08 02:43:00343or it should match what is recorded in refname.</p>
344<p>The hook should exit with non-zero status if it wants to disallow
345updating the named ref. Otherwise it should exit with zero.</p>
346<p>Successful execution (a zero exit status) of this hook does not
347ensure the ref will actully be updated, it is only a prerequisite.
348As such it is not a good idea to send notices (e.g. email) from
349this hook. Consider using the post-receive hook instead.</p>
350</div>
351<h2>post-receive Hook</h2>
352<div class="sectionbody">
353<p>After all refs were updated (or attempted to be updated), if any
354ref update was successful, and if $GIT_DIR/hooks/post-receive
Junio C Hamanoc51fede2007-03-12 07:29:20355file exists and is executable, it will be invoke once with no
356parameters. The standard input of the hook will be one line
357for each successfully updated ref:</p>
Junio C Hamanoabcd65d2007-03-08 02:43:00358<div class="literalblock">
359<div class="content">
Junio C Hamanoc51fede2007-03-12 07:29:20360<pre><tt>sha1-old SP sha1-new SP refname LF</tt></pre>
Junio C Hamanoabcd65d2007-03-08 02:43:00361</div></div>
Junio C Hamanoc51fede2007-03-12 07:29:20362<p>The refname value is relative to $GIT_DIR; e.g. for the master
363head this is "refs/heads/master". The two sha1 values before
Junio C Hamanoabcd65d2007-03-08 02:43:00364each refname are the object names for the refname before and after
365the update. Refs that were created will have sha1-old equal to
Junio C Hamano1d90cb02007-07-03 07:05:313660{40}, while refs that were deleted will have sha1-new equal to
3670{40}, otherwise sha1-old and sha1-new should be valid objects in
Junio C Hamanoabcd65d2007-03-08 02:43:00368the repository.</p>
369<p>Using this hook, it is easy to generate mails describing the updates
370to the repository. This example script sends one mail message per
371ref listing the commits pushed to the repository:</p>
372<div class="literalblock">
373<div class="content">
374<pre><tt>#!/bin/sh
375# mail out commit update information.
Junio C Hamanoc51fede2007-03-12 07:29:20376while read oval nval ref
Junio C Hamanoabcd65d2007-03-08 02:43:00377do
Junio C Hamanoc51fede2007-03-12 07:29:20378 if expr "$oval" : '0*$' &gt;/dev/null
Junio C Hamanoabcd65d2007-03-08 02:43:00379 then
380 echo "Created a new ref, with the following commits:"
Junio C Hamanoc51fede2007-03-12 07:29:20381 git-rev-list --pretty "$nval"
Junio C Hamanoabcd65d2007-03-08 02:43:00382 else
383 echo "New commits:"
Junio C Hamanoc51fede2007-03-12 07:29:20384 git-rev-list --pretty "$nval" "^$oval"
Junio C Hamanoabcd65d2007-03-08 02:43:00385 fi |
Junio C Hamanoc51fede2007-03-12 07:29:20386 mail -s "Changes to ref $ref" commit-list@mydomain
Junio C Hamanoabcd65d2007-03-08 02:43:00387done
388exit 0</tt></pre>
389</div></div>
390<p>The exit code from this hook invocation is ignored, however a
391non-zero exit code will generate an error message.</p>
392<p>Note that it is possible for refname to not have sha1-new when this
393hook runs. This can easily occur if another user modifies the ref
394after it was updated by receive-pack, but before the hook was able
395to evaluate it. It is recommended that hooks rely on sha1-new
396rather than the current value of refname.</p>
397</div>
398<h2>post-update Hook</h2>
399<div class="sectionbody">
400<p>After all other processing, if at least one ref was updated, and
401if $GIT_DIR/hooks/post-update file exists and is executable, then
402post-update will called with the list of refs that have been updated.
403This can be used to implement any repository wide cleanup tasks.</p>
404<p>The exit code from this hook invocation is ignored; the only thing
405left for git-receive-pack to do at that point is to exit itself
406anyway.</p>
407<p>This hook can be used, for example, to run "git-update-server-info"
408if the repository is packed and is served via a dumb transport.</p>
409<div class="literalblock">
410<div class="content">
411<pre><tt>#!/bin/sh
412exec git-update-server-info</tt></pre>
413</div></div>
414</div>
Junio C Hamano1a4e8412005-12-27 08:17:23415<h2>SEE ALSO</h2>
416<div class="sectionbody">
417<p><a href="git-send-pack.html">git-send-pack(1)</a></p>
418</div>
419<h2>Author</h2>
420<div class="sectionbody">
421<p>Written by Linus Torvalds &lt;torvalds@osdl.org&gt;</p>
422</div>
423<h2>Documentation</h2>
424<div class="sectionbody">
425<p>Documentation by Junio C Hamano.</p>
426</div>
427<h2>GIT</h2>
428<div class="sectionbody">
429<p>Part of the <a href="git.html">git(7)</a> suite</p>
430</div>
431<div id="footer">
432<div id="footer-text">
Junio C Hamano1d90cb02007-07-03 07:05:31433Last updated 03-Jul-2007 07:03:43 UTC
Junio C Hamano1a4e8412005-12-27 08:17:23434</div>
435</div>
436</body>
437</html>