blob: 8701f653d3f0f301b48be7a48b32fd7a478ed224 [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 Hamano40f2f8d2006-02-07 08:04:396<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-push(1)</title>
260</head>
261<body>
262<div id="header">
263<h1>
264git-push(1) Manual Page
265</h1>
266<h2>NAME</h2>
267<div class="sectionbody">
268<p>git-push -
Junio C Hamano01078922006-03-10 00:31:47269 Update remote refs along with associated objects
Junio C Hamano1a4e8412005-12-27 08:17:23270</p>
271</div>
272</div>
273<h2>SYNOPSIS</h2>
274<div class="sectionbody">
Junio C Hamanoa9b8d242007-05-19 04:51:55275<div class="verseblock">
Junio C Hamano764a6672007-10-23 01:23:31276<div class="content"><em>git-push</em> [--all] [--dry-run] [--tags] [--receive-pack=&lt;git-receive-pack&gt;]
Junio C Hamanoa9b8d242007-05-19 04:51:55277 [--repo=all] [-f | --force] [-v] [&lt;repository&gt; &lt;refspec&gt;&#8230;]</div></div>
Junio C Hamano1a4e8412005-12-27 08:17:23278</div>
279<h2>DESCRIPTION</h2>
280<div class="sectionbody">
281<p>Updates remote refs using local refs, while sending objects
282necessary to complete the given refs.</p>
Junio C Hamano40f2f8d2006-02-07 08:04:39283<p>You can make interesting things happen to a repository
Junio C Hamano1a4e8412005-12-27 08:17:23284every time you push into it, by setting up <em>hooks</em> there. See
285documentation for <a href="git-receive-pack.html">git-receive-pack(1)</a>.</p>
286</div>
287<h2>OPTIONS</h2>
288<div class="sectionbody">
289<dl>
290<dt>
291&lt;repository&gt;
292</dt>
293<dd>
294<p>
Junio C Hamano40f2f8d2006-02-07 08:04:39295 The "remote" repository that is destination of a push
296 operation. See the section <a href="#URLS">GIT URLS</a> below.
Junio C Hamano1a4e8412005-12-27 08:17:23297</p>
Junio C Hamano40f2f8d2006-02-07 08:04:39298</dd>
299<dt>
300&lt;refspec&gt;
301</dt>
302<dd>
303<p>
304 The canonical format of a &lt;refspec&gt; parameter is
305 <tt>+?&lt;src&gt;:&lt;dst&gt;</tt>; that is, an optional plus <tt>+</tt>, followed
306 by the source ref, followed by a colon <tt>:</tt>, followed by
307 the destination ref.
308</p>
309<p>The &lt;src&gt; side can be an
310arbitrary "SHA1 expression" that can be used as an
311argument to <tt>git-cat-file -t</tt>. E.g. <tt>master~4</tt> (push
312four parents before the current master head).</p>
313<p>The local ref that matches &lt;src&gt; is used
314to fast forward the remote ref that matches &lt;dst&gt;. If
315the optional plus <tt>+</tt> is used, the remote ref is updated
316even if it does not result in a fast forward update.</p>
Junio C Hamano7e9f6b72006-02-22 10:44:55317<p>Note: If no explicit refspec is found, (that is neither
318on the command line nor in any Push line of the
319corresponding remotes file---see below), then all the
Junio C Hamanod2d9ae12007-09-19 02:27:57320heads that exist both on the local side and on the remote
Junio C Hamano7e9f6b72006-02-22 10:44:55321side are updated.</p>
Junio C Hamano3f403b02006-12-13 10:14:13322<p><tt>tag &lt;tag&gt;</tt> means the same as <tt>refs/tags/&lt;tag&gt;:refs/tags/&lt;tag&gt;</tt>.</p>
Junio C Hamano6926bef2007-06-16 09:54:05323<p>A parameter &lt;ref&gt; without a colon pushes the &lt;ref&gt; from the source
324repository to the destination repository under the same name.</p>
Junio C Hamano3f403b02006-12-13 10:14:13325<p>Pushing an empty &lt;src&gt; allows you to delete the &lt;dst&gt; ref from
326the remote repository.</p>
Junio C Hamano40f2f8d2006-02-07 08:04:39327</dd>
328<dt>
329--all
330</dt>
331<dd>
332<p>
333 Instead of naming each ref to push, specifies that all
Junio C Hamanod2d9ae12007-09-19 02:27:57334 refs under <tt>$GIT_DIR/refs/heads/</tt> be pushed.
Junio C Hamano40f2f8d2006-02-07 08:04:39335</p>
336</dd>
337<dt>
Junio C Hamano764a6672007-10-23 01:23:31338--dry-run
339</dt>
340<dd>
341<p>
342 Do everything except actually send the updates.
343</p>
344</dd>
345<dt>
Junio C Hamano40f2f8d2006-02-07 08:04:39346--tags
347</dt>
348<dd>
349<p>
350 All refs under <tt>$GIT_DIR/refs/tags</tt> are pushed, in
351 addition to refspecs explicitly listed on the command
352 line.
353</p>
354</dd>
355<dt>
Junio C Hamano4ad294b2007-01-20 02:22:50356--receive-pack=&lt;git-receive-pack&gt;
Junio C Hamano1ce39ab2007-01-16 22:05:10357</dt>
358<dd>
359<p>
360 Path to the <em>git-receive-pack</em> program on the remote
361 end. Sometimes useful when pushing to a remote
362 repository over ssh, and you do not have the program in
363 a directory on the default $PATH.
364</p>
365</dd>
366<dt>
Junio C Hamano4ad294b2007-01-20 02:22:50367--exec=&lt;git-receive-pack&gt;
368</dt>
369<dd>
370<p>
371 Same as --receive-pack=&lt;git-receive-pack&gt;.
372</p>
373</dd>
374<dt>
Junio C Hamano40f2f8d2006-02-07 08:04:39375-f, --force
376</dt>
377<dd>
378<p>
379 Usually, the command refuses to update a remote ref that is
Junio C Hamano4cd1c0e2007-08-06 04:39:14380 not an ancestor of the local ref used to overwrite it.
Junio C Hamano40f2f8d2006-02-07 08:04:39381 This flag disables the check. This can cause the
382 remote repository to lose commits; use it with care.
383</p>
384</dd>
Junio C Hamano1ce39ab2007-01-16 22:05:10385<dt>
386--repo=&lt;repo&gt;
387</dt>
388<dd>
389<p>
390 When no repository is specified the command defaults to
391 "origin"; this overrides it.
392</p>
393</dd>
394<dt>
395--thin, --no-thin
396</dt>
397<dd>
398<p>
399 These options are passed to <tt>git-send-pack</tt>. Thin
400 transfer spends extra cycles to minimize the number of
401 objects to be sent and meant to be used on slower connection.
402</p>
403</dd>
404<dt>
405-v
406</dt>
407<dd>
408<p>
409 Run verbosely.
410</p>
411</dd>
Junio C Hamano40f2f8d2006-02-07 08:04:39412</dl>
413</div>
414<h2>GIT URLS<a id="URLS"></a></h2>
415<div class="sectionbody">
416<p>One of the following notations can be used
417to name the remote repository:</p>
Junio C Hamano1a4e8412005-12-27 08:17:23418<div class="exampleblock">
419<div class="exampleblock-content">
420<ul>
421<li>
422<p>
423rsync://host.xz/path/to/repo.git/
424</p>
425</li>
426<li>
427<p>
428http://host.xz/path/to/repo.git/
429</p>
430</li>
431<li>
432<p>
433https://host.xz/path/to/repo.git/
434</p>
435</li>
436<li>
437<p>
438git://host.xz/path/to/repo.git/
439</p>
440</li>
441<li>
442<p>
443git://host.xz/~user/path/to/repo.git/
444</p>
445</li>
446<li>
447<p>
Junio C Hamanodbb64592007-09-01 11:17:39448ssh://&#91;user@&#93;host.xz&#91;:port&#93;/path/to/repo.git/
449</p>
450</li>
451<li>
452<p>
Junio C Hamano7ccb9fd2006-07-15 01:38:40453ssh://&#91;user@&#93;host.xz/path/to/repo.git/
Junio C Hamano1a4e8412005-12-27 08:17:23454</p>
455</li>
456<li>
457<p>
Junio C Hamano7ccb9fd2006-07-15 01:38:40458ssh://&#91;user@&#93;host.xz/~user/path/to/repo.git/
Junio C Hamano1a4e8412005-12-27 08:17:23459</p>
460</li>
461<li>
462<p>
Junio C Hamano7ccb9fd2006-07-15 01:38:40463ssh://&#91;user@&#93;host.xz/~/path/to/repo.git
Junio C Hamano1a4e8412005-12-27 08:17:23464</p>
465</li>
466</ul>
467</div></div>
Junio C Hamanob1d6e882007-08-11 08:30:16468<p>SSH is the default transport protocol over the network. You can
469optionally specify which user to log-in as, and an alternate,
470scp-like syntax is also supported. Both syntaxes support
Junio C Hamanodbb64592007-09-01 11:17:39471username expansion, as does the native git protocol, but
472only the former supports port specification. The following
Junio C Hamanob1d6e882007-08-11 08:30:16473three are identical to the last three above, respectively:</p>
Junio C Hamano1a4e8412005-12-27 08:17:23474<div class="exampleblock">
475<div class="exampleblock-content">
476<ul>
477<li>
478<p>
Junio C Hamano7ccb9fd2006-07-15 01:38:40479&#91;user@&#93;host.xz:/path/to/repo.git/
Junio C Hamano1a4e8412005-12-27 08:17:23480</p>
481</li>
482<li>
483<p>
Junio C Hamano7ccb9fd2006-07-15 01:38:40484&#91;user@&#93;host.xz:~user/path/to/repo.git/
Junio C Hamano1a4e8412005-12-27 08:17:23485</p>
486</li>
487<li>
488<p>
Junio C Hamano7ccb9fd2006-07-15 01:38:40489&#91;user@&#93;host.xz:path/to/repo.git
Junio C Hamano1a4e8412005-12-27 08:17:23490</p>
491</li>
492</ul>
493</div></div>
Junio C Hamanob1d6e882007-08-11 08:30:16494<p>To sync with a local directory, you can use:</p>
Junio C Hamano1a4e8412005-12-27 08:17:23495<div class="exampleblock">
496<div class="exampleblock-content">
497<ul>
498<li>
499<p>
500/path/to/repo.git/
501</p>
502</li>
Junio C Hamanob1d6e882007-08-11 08:30:16503<li>
504<p>
505file:///path/to/repo.git/
506</p>
507</li>
Junio C Hamano1a4e8412005-12-27 08:17:23508</ul>
509</div></div>
Junio C Hamanob1d6e882007-08-11 08:30:16510<p>They are mostly equivalent, except when cloning. See
511<a href="git-clone.html">git-clone(1)</a> for details.</p>
Junio C Hamano40f2f8d2006-02-07 08:04:39512</div>
513<h2>REMOTES</h2>
514<div class="sectionbody">
Junio C Hamano1a4e8412005-12-27 08:17:23515<p>In addition to the above, as a short-hand, the name of a
516file in <tt>$GIT_DIR/remotes</tt> directory can be given; the
517named file should be in the following format:</p>
Junio C Hamano1caaf472006-12-31 08:29:35518<div class="listingblock">
Junio C Hamano1a4e8412005-12-27 08:17:23519<div class="content">
Junio C Hamanod3361ad2007-01-01 03:20:24520<pre><tt> URL: one of the above URL format
521 Push: &lt;refspec&gt;
522 Pull: &lt;refspec&gt;
523</tt></pre>
Junio C Hamano1a4e8412005-12-27 08:17:23524</div></div>
Junio C Hamano40f2f8d2006-02-07 08:04:39525<p>Then such a short-hand is specified in place of
Junio C Hamano1a4e8412005-12-27 08:17:23526&lt;repository&gt; without &lt;refspec&gt; parameters on the command
527line, &lt;refspec&gt; specified on <tt>Push:</tt> lines or <tt>Pull:</tt>
528lines are used for <tt>git-push</tt> and <tt>git-fetch</tt>/<tt>git-pull</tt>,
Junio C Hamano51c2ab02006-07-09 20:38:54529respectively. Multiple <tt>Push:</tt> and <tt>Pull:</tt> lines may
Junio C Hamano1a4e8412005-12-27 08:17:23530be specified for additional branch mappings.</p>
Junio C Hamano249572f2006-10-24 05:44:08531<p>Or, equivalently, in the <tt>$GIT_DIR/config</tt> (note the use
532of <tt>fetch</tt> instead of <tt>Pull:</tt>):</p>
Junio C Hamano1caaf472006-12-31 08:29:35533<div class="listingblock">
Junio C Hamano249572f2006-10-24 05:44:08534<div class="content">
Junio C Hamanod3361ad2007-01-01 03:20:24535<pre><tt> [remote "&lt;remote&gt;"]
536 url = &lt;url&gt;
537 push = &lt;refspec&gt;
538 fetch = &lt;refspec&gt;
539</tt></pre>
Junio C Hamano249572f2006-10-24 05:44:08540</div></div>
Junio C Hamano1a4e8412005-12-27 08:17:23541<p>The name of a file in <tt>$GIT_DIR/branches</tt> directory can be
542specified as an older notation short-hand; the named
543file should contain a single line, a URL in one of the
544above formats, optionally followed by a hash <tt>#</tt> and the
545name of remote head (URL fragment notation).
546<tt>$GIT_DIR/branches/&lt;remote&gt;</tt> file that stores a &lt;url&gt;
547without the fragment is equivalent to have this in the
548corresponding file in the <tt>$GIT_DIR/remotes/</tt> directory.</p>
Junio C Hamano1caaf472006-12-31 08:29:35549<div class="listingblock">
Junio C Hamano1a4e8412005-12-27 08:17:23550<div class="content">
Junio C Hamanod3361ad2007-01-01 03:20:24551<pre><tt> URL: &lt;url&gt;
552 Pull: refs/heads/master:&lt;remote&gt;
553</tt></pre>
Junio C Hamano1a4e8412005-12-27 08:17:23554</div></div>
555<p>while having <tt>&lt;url&gt;#&lt;head&gt;</tt> is equivalent to</p>
Junio C Hamano1caaf472006-12-31 08:29:35556<div class="listingblock">
Junio C Hamano1a4e8412005-12-27 08:17:23557<div class="content">
Junio C Hamanod3361ad2007-01-01 03:20:24558<pre><tt> URL: &lt;url&gt;
559 Pull: refs/heads/&lt;head&gt;:&lt;remote&gt;</tt></pre>
Junio C Hamano1a4e8412005-12-27 08:17:23560</div></div>
Junio C Hamano1a4e8412005-12-27 08:17:23561</div>
Junio C Hamano6926bef2007-06-16 09:54:05562<h2>Examples</h2>
563<div class="sectionbody">
564<dl>
565<dt>
566git push origin master
567</dt>
568<dd>
569<p>
570 Find a ref that matches <tt>master</tt> in the source repository
571 (most likely, it would find <tt>refs/heads/master</tt>), and update
572 the same ref (e.g. <tt>refs/heads/master</tt>) in <tt>origin</tt> repository
573 with it.
574</p>
575</dd>
576<dt>
577git push origin :experimental
578</dt>
579<dd>
580<p>
581 Find a ref that matches <tt>experimental</tt> in the <tt>origin</tt> repository
582 (e.g. <tt>refs/heads/experimental</tt>), and delete it.
583</p>
584</dd>
585<dt>
586git push origin master:satellite/master
587</dt>
588<dd>
589<p>
590 Find a ref that matches <tt>master</tt> in the source repository
591 (most likely, it would find <tt>refs/heads/master</tt>), and update
592 the ref that matches <tt>satellite/master</tt> (most likely, it would
593 be <tt>refs/remotes/satellite/master</tt>) in <tt>origin</tt> repository with it.
594</p>
595</dd>
Junio C Hamanobfd4f9a2007-09-06 08:52:44596<dt>
597git push origin master:refs/heads/experimental
598</dt>
599<dd>
600<p>
601 Create the branch <tt>experimental</tt> in the <tt>origin</tt> repository
602 by copying the current <tt>master</tt> branch. This form is usually
603 needed to create a new branch in the remote repository as
604 there is no <tt>experimental</tt> branch to match.
605</p>
606</dd>
Junio C Hamano6926bef2007-06-16 09:54:05607</dl>
608</div>
Junio C Hamano1a4e8412005-12-27 08:17:23609<h2>Author</h2>
610<div class="sectionbody">
Junio C Hamano3f403b02006-12-13 10:14:13611<p>Written by Junio C Hamano &lt;junkio@cox.net&gt;, later rewritten in C
612by Linus Torvalds &lt;torvalds@osdl.org&gt;</p>
Junio C Hamano1a4e8412005-12-27 08:17:23613</div>
614<h2>Documentation</h2>
615<div class="sectionbody">
616<p>Documentation by Junio C Hamano and the git-list &lt;git@vger.kernel.org&gt;.</p>
617</div>
618<h2>GIT</h2>
619<div class="sectionbody">
620<p>Part of the <a href="git.html">git(7)</a> suite</p>
621</div>
622<div id="footer">
623<div id="footer-text">
Junio C Hamano764a6672007-10-23 01:23:31624Last updated 23-Oct-2007 01:21:51 UTC
Junio C Hamano1a4e8412005-12-27 08:17:23625</div>
626</div>
627</body>
628</html>