blob: a2f60173b9659ee939662032fae34b2338c2a3e7 [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 Hamano3cc17392007-11-12 04:27:07277 [--repo=all] [-f | --force] [-v | --verbose] [&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 Hamano9d2bbb72007-11-25 04:56:07338--mirror
339</dt>
340<dd>
341<p>
342 Instead of naming each ref to push, specifies that all
343 refs under <tt>$GIT_DIR/refs/heads/</tt> and <tt>$GIT_DIR/refs/tags/</tt>
344 be mirrored to the remote repository. Newly created local
345 refs will be pushed to the remote end, locally updated refs
346 will be force updated on the remote end, and deleted refs
347 will be removed from the remote end.
348</p>
349</dd>
350<dt>
Junio C Hamano764a6672007-10-23 01:23:31351--dry-run
352</dt>
353<dd>
354<p>
355 Do everything except actually send the updates.
356</p>
357</dd>
358<dt>
Junio C Hamano40f2f8d2006-02-07 08:04:39359--tags
360</dt>
361<dd>
362<p>
363 All refs under <tt>$GIT_DIR/refs/tags</tt> are pushed, in
364 addition to refspecs explicitly listed on the command
365 line.
366</p>
367</dd>
368<dt>
Junio C Hamano4ad294b2007-01-20 02:22:50369--receive-pack=&lt;git-receive-pack&gt;
Junio C Hamano1ce39ab2007-01-16 22:05:10370</dt>
371<dd>
372<p>
373 Path to the <em>git-receive-pack</em> program on the remote
374 end. Sometimes useful when pushing to a remote
375 repository over ssh, and you do not have the program in
376 a directory on the default $PATH.
377</p>
378</dd>
379<dt>
Junio C Hamano4ad294b2007-01-20 02:22:50380--exec=&lt;git-receive-pack&gt;
381</dt>
382<dd>
383<p>
384 Same as --receive-pack=&lt;git-receive-pack&gt;.
385</p>
386</dd>
387<dt>
Junio C Hamano40f2f8d2006-02-07 08:04:39388-f, --force
389</dt>
390<dd>
391<p>
392 Usually, the command refuses to update a remote ref that is
Junio C Hamano4cd1c0e2007-08-06 04:39:14393 not an ancestor of the local ref used to overwrite it.
Junio C Hamano40f2f8d2006-02-07 08:04:39394 This flag disables the check. This can cause the
395 remote repository to lose commits; use it with care.
396</p>
397</dd>
Junio C Hamano1ce39ab2007-01-16 22:05:10398<dt>
399--repo=&lt;repo&gt;
400</dt>
401<dd>
402<p>
403 When no repository is specified the command defaults to
404 "origin"; this overrides it.
405</p>
406</dd>
407<dt>
408--thin, --no-thin
409</dt>
410<dd>
411<p>
412 These options are passed to <tt>git-send-pack</tt>. Thin
413 transfer spends extra cycles to minimize the number of
414 objects to be sent and meant to be used on slower connection.
415</p>
416</dd>
417<dt>
Junio C Hamano3cc17392007-11-12 04:27:07418-v, --verbose
Junio C Hamano1ce39ab2007-01-16 22:05:10419</dt>
420<dd>
421<p>
422 Run verbosely.
423</p>
424</dd>
Junio C Hamano40f2f8d2006-02-07 08:04:39425</dl>
426</div>
427<h2>GIT URLS<a id="URLS"></a></h2>
428<div class="sectionbody">
429<p>One of the following notations can be used
430to name the remote repository:</p>
Junio C Hamano1a4e8412005-12-27 08:17:23431<div class="exampleblock">
432<div class="exampleblock-content">
433<ul>
434<li>
435<p>
436rsync://host.xz/path/to/repo.git/
437</p>
438</li>
439<li>
440<p>
441http://host.xz/path/to/repo.git/
442</p>
443</li>
444<li>
445<p>
446https://host.xz/path/to/repo.git/
447</p>
448</li>
449<li>
450<p>
451git://host.xz/path/to/repo.git/
452</p>
453</li>
454<li>
455<p>
456git://host.xz/~user/path/to/repo.git/
457</p>
458</li>
459<li>
460<p>
Junio C Hamanodbb64592007-09-01 11:17:39461ssh://&#91;user@&#93;host.xz&#91;:port&#93;/path/to/repo.git/
462</p>
463</li>
464<li>
465<p>
Junio C Hamano7ccb9fd2006-07-15 01:38:40466ssh://&#91;user@&#93;host.xz/path/to/repo.git/
Junio C Hamano1a4e8412005-12-27 08:17:23467</p>
468</li>
469<li>
470<p>
Junio C Hamano7ccb9fd2006-07-15 01:38:40471ssh://&#91;user@&#93;host.xz/~user/path/to/repo.git/
Junio C Hamano1a4e8412005-12-27 08:17:23472</p>
473</li>
474<li>
475<p>
Junio C Hamano7ccb9fd2006-07-15 01:38:40476ssh://&#91;user@&#93;host.xz/~/path/to/repo.git
Junio C Hamano1a4e8412005-12-27 08:17:23477</p>
478</li>
479</ul>
480</div></div>
Junio C Hamanob1d6e882007-08-11 08:30:16481<p>SSH is the default transport protocol over the network. You can
482optionally specify which user to log-in as, and an alternate,
483scp-like syntax is also supported. Both syntaxes support
Junio C Hamanodbb64592007-09-01 11:17:39484username expansion, as does the native git protocol, but
485only the former supports port specification. The following
Junio C Hamanob1d6e882007-08-11 08:30:16486three are identical to the last three above, respectively:</p>
Junio C Hamano1a4e8412005-12-27 08:17:23487<div class="exampleblock">
488<div class="exampleblock-content">
489<ul>
490<li>
491<p>
Junio C Hamano7ccb9fd2006-07-15 01:38:40492&#91;user@&#93;host.xz:/path/to/repo.git/
Junio C Hamano1a4e8412005-12-27 08:17:23493</p>
494</li>
495<li>
496<p>
Junio C Hamano7ccb9fd2006-07-15 01:38:40497&#91;user@&#93;host.xz:~user/path/to/repo.git/
Junio C Hamano1a4e8412005-12-27 08:17:23498</p>
499</li>
500<li>
501<p>
Junio C Hamano7ccb9fd2006-07-15 01:38:40502&#91;user@&#93;host.xz:path/to/repo.git
Junio C Hamano1a4e8412005-12-27 08:17:23503</p>
504</li>
505</ul>
506</div></div>
Junio C Hamanob1d6e882007-08-11 08:30:16507<p>To sync with a local directory, you can use:</p>
Junio C Hamano1a4e8412005-12-27 08:17:23508<div class="exampleblock">
509<div class="exampleblock-content">
510<ul>
511<li>
512<p>
513/path/to/repo.git/
514</p>
515</li>
Junio C Hamanob1d6e882007-08-11 08:30:16516<li>
517<p>
518file:///path/to/repo.git/
519</p>
520</li>
Junio C Hamano1a4e8412005-12-27 08:17:23521</ul>
522</div></div>
Junio C Hamanob1d6e882007-08-11 08:30:16523<p>They are mostly equivalent, except when cloning. See
524<a href="git-clone.html">git-clone(1)</a> for details.</p>
Junio C Hamano40f2f8d2006-02-07 08:04:39525</div>
526<h2>REMOTES</h2>
527<div class="sectionbody">
Junio C Hamano1a4e8412005-12-27 08:17:23528<p>In addition to the above, as a short-hand, the name of a
529file in <tt>$GIT_DIR/remotes</tt> directory can be given; the
530named file should be in the following format:</p>
Junio C Hamano1caaf472006-12-31 08:29:35531<div class="listingblock">
Junio C Hamano1a4e8412005-12-27 08:17:23532<div class="content">
Junio C Hamanod3361ad2007-01-01 03:20:24533<pre><tt> URL: one of the above URL format
534 Push: &lt;refspec&gt;
535 Pull: &lt;refspec&gt;
536</tt></pre>
Junio C Hamano1a4e8412005-12-27 08:17:23537</div></div>
Junio C Hamano40f2f8d2006-02-07 08:04:39538<p>Then such a short-hand is specified in place of
Junio C Hamano1a4e8412005-12-27 08:17:23539&lt;repository&gt; without &lt;refspec&gt; parameters on the command
540line, &lt;refspec&gt; specified on <tt>Push:</tt> lines or <tt>Pull:</tt>
541lines are used for <tt>git-push</tt> and <tt>git-fetch</tt>/<tt>git-pull</tt>,
Junio C Hamano51c2ab02006-07-09 20:38:54542respectively. Multiple <tt>Push:</tt> and <tt>Pull:</tt> lines may
Junio C Hamano1a4e8412005-12-27 08:17:23543be specified for additional branch mappings.</p>
Junio C Hamano249572f2006-10-24 05:44:08544<p>Or, equivalently, in the <tt>$GIT_DIR/config</tt> (note the use
545of <tt>fetch</tt> instead of <tt>Pull:</tt>):</p>
Junio C Hamano1caaf472006-12-31 08:29:35546<div class="listingblock">
Junio C Hamano249572f2006-10-24 05:44:08547<div class="content">
Junio C Hamanod3361ad2007-01-01 03:20:24548<pre><tt> [remote "&lt;remote&gt;"]
549 url = &lt;url&gt;
550 push = &lt;refspec&gt;
551 fetch = &lt;refspec&gt;
552</tt></pre>
Junio C Hamano249572f2006-10-24 05:44:08553</div></div>
Junio C Hamano1a4e8412005-12-27 08:17:23554<p>The name of a file in <tt>$GIT_DIR/branches</tt> directory can be
555specified as an older notation short-hand; the named
556file should contain a single line, a URL in one of the
557above formats, optionally followed by a hash <tt>#</tt> and the
558name of remote head (URL fragment notation).
559<tt>$GIT_DIR/branches/&lt;remote&gt;</tt> file that stores a &lt;url&gt;
560without the fragment is equivalent to have this in the
561corresponding file in the <tt>$GIT_DIR/remotes/</tt> directory.</p>
Junio C Hamano1caaf472006-12-31 08:29:35562<div class="listingblock">
Junio C Hamano1a4e8412005-12-27 08:17:23563<div class="content">
Junio C Hamanod3361ad2007-01-01 03:20:24564<pre><tt> URL: &lt;url&gt;
565 Pull: refs/heads/master:&lt;remote&gt;
566</tt></pre>
Junio C Hamano1a4e8412005-12-27 08:17:23567</div></div>
568<p>while having <tt>&lt;url&gt;#&lt;head&gt;</tt> is equivalent to</p>
Junio C Hamano1caaf472006-12-31 08:29:35569<div class="listingblock">
Junio C Hamano1a4e8412005-12-27 08:17:23570<div class="content">
Junio C Hamanod3361ad2007-01-01 03:20:24571<pre><tt> URL: &lt;url&gt;
572 Pull: refs/heads/&lt;head&gt;:&lt;remote&gt;</tt></pre>
Junio C Hamano1a4e8412005-12-27 08:17:23573</div></div>
Junio C Hamano1a4e8412005-12-27 08:17:23574</div>
Junio C Hamano6926bef2007-06-16 09:54:05575<h2>Examples</h2>
576<div class="sectionbody">
577<dl>
578<dt>
579git push origin master
580</dt>
581<dd>
582<p>
583 Find a ref that matches <tt>master</tt> in the source repository
584 (most likely, it would find <tt>refs/heads/master</tt>), and update
585 the same ref (e.g. <tt>refs/heads/master</tt>) in <tt>origin</tt> repository
586 with it.
587</p>
588</dd>
589<dt>
590git push origin :experimental
591</dt>
592<dd>
593<p>
594 Find a ref that matches <tt>experimental</tt> in the <tt>origin</tt> repository
595 (e.g. <tt>refs/heads/experimental</tt>), and delete it.
596</p>
597</dd>
598<dt>
599git push origin master:satellite/master
600</dt>
601<dd>
602<p>
603 Find a ref that matches <tt>master</tt> in the source repository
604 (most likely, it would find <tt>refs/heads/master</tt>), and update
605 the ref that matches <tt>satellite/master</tt> (most likely, it would
606 be <tt>refs/remotes/satellite/master</tt>) in <tt>origin</tt> repository with it.
607</p>
608</dd>
Junio C Hamanobfd4f9a2007-09-06 08:52:44609<dt>
610git push origin master:refs/heads/experimental
611</dt>
612<dd>
613<p>
614 Create the branch <tt>experimental</tt> in the <tt>origin</tt> repository
615 by copying the current <tt>master</tt> branch. This form is usually
616 needed to create a new branch in the remote repository as
617 there is no <tt>experimental</tt> branch to match.
618</p>
619</dd>
Junio C Hamano6926bef2007-06-16 09:54:05620</dl>
621</div>
Junio C Hamano1a4e8412005-12-27 08:17:23622<h2>Author</h2>
623<div class="sectionbody">
Junio C Hamano3f403b02006-12-13 10:14:13624<p>Written by Junio C Hamano &lt;junkio@cox.net&gt;, later rewritten in C
625by Linus Torvalds &lt;torvalds@osdl.org&gt;</p>
Junio C Hamano1a4e8412005-12-27 08:17:23626</div>
627<h2>Documentation</h2>
628<div class="sectionbody">
629<p>Documentation by Junio C Hamano and the git-list &lt;git@vger.kernel.org&gt;.</p>
630</div>
631<h2>GIT</h2>
632<div class="sectionbody">
633<p>Part of the <a href="git.html">git(7)</a> suite</p>
634</div>
635<div id="footer">
636<div id="footer-text">
Junio C Hamano35738e82008-01-07 07:55:46637Last updated 07-Jan-2008 07:50:37 UTC
Junio C Hamano1a4e8412005-12-27 08:17:23638</div>
639</div>
640</body>
641</html>