blob: 0da7abf2b556aa1873d5032af6a25da281da0c76 [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 Hamanoba4b9282008-07-06 05:20:316<meta name="generator" content="AsciiDoc 8.2.5" />
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
Junio C Hamanoba4b9282008-07-06 05:20:3119a {
20 color: blue;
21 text-decoration: underline;
22}
23a:visited {
24 color: fuchsia;
25}
Junio C Hamano1a4e8412005-12-27 08:17:2326
27em {
28 font-style: italic;
29}
30
31strong {
32 font-weight: bold;
33}
34
35tt {
36 color: navy;
37}
38
39h1, h2, h3, h4, h5, h6 {
40 color: #527bbd;
41 font-family: sans-serif;
42 margin-top: 1.2em;
43 margin-bottom: 0.5em;
44 line-height: 1.3;
45}
46
Junio C Hamanoba4b9282008-07-06 05:20:3147h1, h2, h3 {
Junio C Hamano1a4e8412005-12-27 08:17:2348 border-bottom: 2px solid silver;
49}
50h2 {
Junio C Hamano1a4e8412005-12-27 08:17:2351 padding-top: 0.5em;
52}
Junio C Hamanoba4b9282008-07-06 05:20:3153h3 {
54 float: left;
55}
56h3 + * {
57 clear: left;
58}
Junio C Hamano1a4e8412005-12-27 08:17:2359
60div.sectionbody {
61 font-family: serif;
62 margin-left: 0;
63}
64
65hr {
66 border: 1px solid silver;
67}
68
69p {
70 margin-top: 0.5em;
71 margin-bottom: 0.5em;
72}
73
74pre {
75 padding: 0;
76 margin: 0;
77}
78
79span#author {
80 color: #527bbd;
81 font-family: sans-serif;
82 font-weight: bold;
Junio C Hamanoba4b9282008-07-06 05:20:3183 font-size: 1.1em;
Junio C Hamano1a4e8412005-12-27 08:17:2384}
85span#email {
86}
87span#revision {
88 font-family: sans-serif;
89}
90
91div#footer {
92 font-family: sans-serif;
93 font-size: small;
94 border-top: 2px solid silver;
95 padding-top: 0.5em;
96 margin-top: 4.0em;
97}
98div#footer-text {
99 float: left;
100 padding-bottom: 0.5em;
101}
102div#footer-badges {
103 float: right;
104 padding-bottom: 0.5em;
105}
106
107div#preamble,
108div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
109div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
110div.admonitionblock {
111 margin-right: 10%;
112 margin-top: 1.5em;
113 margin-bottom: 1.5em;
114}
115div.admonitionblock {
116 margin-top: 2.5em;
117 margin-bottom: 2.5em;
118}
119
120div.content { /* Block element content. */
121 padding: 0;
122}
123
124/* Block element titles. */
125div.title, caption.title {
126 font-family: sans-serif;
127 font-weight: bold;
128 text-align: left;
129 margin-top: 1.0em;
130 margin-bottom: 0.5em;
131}
132div.title + * {
133 margin-top: 0;
134}
135
136td div.title:first-child {
137 margin-top: 0.0em;
138}
139div.content div.title:first-child {
140 margin-top: 0.0em;
141}
142div.content + div.title {
143 margin-top: 0.0em;
144}
145
146div.sidebarblock > div.content {
147 background: #ffffee;
148 border: 1px solid silver;
149 padding: 0.5em;
150}
151
Junio C Hamanoba4b9282008-07-06 05:20:31152div.listingblock {
153 margin-right: 0%;
154}
Junio C Hamano1a4e8412005-12-27 08:17:23155div.listingblock > div.content {
156 border: 1px solid silver;
157 background: #f4f4f4;
158 padding: 0.5em;
159}
160
161div.quoteblock > div.content {
162 padding-left: 2.0em;
163}
Junio C Hamanoba4b9282008-07-06 05:20:31164
165div.attribution {
Junio C Hamano1a4e8412005-12-27 08:17:23166 text-align: right;
167}
Junio C Hamanoba4b9282008-07-06 05:20:31168div.verseblock + div.attribution {
169 text-align: left;
170}
Junio C Hamano1a4e8412005-12-27 08:17:23171
172div.admonitionblock .icon {
173 vertical-align: top;
174 font-size: 1.1em;
175 font-weight: bold;
176 text-decoration: underline;
177 color: #527bbd;
178 padding-right: 0.5em;
179}
180div.admonitionblock td.content {
181 padding-left: 0.5em;
182 border-left: 2px solid silver;
183}
184
185div.exampleblock > div.content {
186 border-left: 2px solid silver;
187 padding: 0.5em;
188}
189
190div.verseblock div.content {
191 white-space: pre;
192}
193
194div.imageblock div.content { padding-left: 0; }
195div.imageblock img { border: 1px solid silver; }
196span.image img { border-style: none; }
197
198dl {
199 margin-top: 0.8em;
200 margin-bottom: 0.8em;
201}
202dt {
203 margin-top: 0.5em;
204 margin-bottom: 0;
205 font-style: italic;
206}
207dd > *:first-child {
208 margin-top: 0;
209}
210
211ul, ol {
212 list-style-position: outside;
213}
Junio C Hamanoba4b9282008-07-06 05:20:31214div.olist2 ol {
Junio C Hamano1a4e8412005-12-27 08:17:23215 list-style-type: lower-alpha;
216}
217
218div.tableblock > table {
Junio C Hamanoba4b9282008-07-06 05:20:31219 border: 3px solid #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23220}
221thead {
222 font-family: sans-serif;
223 font-weight: bold;
224}
225tfoot {
226 font-weight: bold;
227}
228
229div.hlist {
230 margin-top: 0.8em;
231 margin-bottom: 0.8em;
232}
Junio C Hamanoba4b9282008-07-06 05:20:31233div.hlist td {
234 padding-bottom: 5px;
235}
Junio C Hamano1a4e8412005-12-27 08:17:23236td.hlist1 {
237 vertical-align: top;
238 font-style: italic;
239 padding-right: 0.8em;
240}
241td.hlist2 {
242 vertical-align: top;
243}
244
245@media print {
246 div#footer-badges { display: none; }
247}
Junio C Hamanoba4b9282008-07-06 05:20:31248
249div#toctitle {
250 color: #527bbd;
251 font-family: sans-serif;
252 font-size: 1.1em;
253 font-weight: bold;
254 margin-top: 1.0em;
255 margin-bottom: 0.1em;
256}
257
258div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
259 margin-top: 0;
260 margin-bottom: 0;
261}
262div.toclevel2 {
263 margin-left: 2em;
264 font-size: 0.9em;
265}
266div.toclevel3 {
267 margin-left: 4em;
268 font-size: 0.9em;
269}
270div.toclevel4 {
271 margin-left: 6em;
272 font-size: 0.9em;
273}
274include1::./stylesheets/xhtml11-manpage.css[]
Junio C Hamano1a4e8412005-12-27 08:17:23275/* Workarounds for IE6's broken and incomplete CSS2. */
276
277div.sidebar-content {
278 background: #ffffee;
279 border: 1px solid silver;
280 padding: 0.5em;
281}
282div.sidebar-title, div.image-title {
283 font-family: sans-serif;
284 font-weight: bold;
285 margin-top: 0.0em;
286 margin-bottom: 0.5em;
287}
288
289div.listingblock div.content {
290 border: 1px solid silver;
291 background: #f4f4f4;
292 padding: 0.5em;
293}
294
295div.quoteblock-content {
296 padding-left: 2.0em;
297}
298
299div.exampleblock-content {
300 border-left: 2px solid silver;
301 padding-left: 0.5em;
302}
Junio C Hamanoba4b9282008-07-06 05:20:31303
304/* IE6 sets dynamically generated links as visited. */
305div#toc a:visited { color: blue; }
Junio C Hamano1a4e8412005-12-27 08:17:23306</style>
307<title>git-push(1)</title>
308</head>
309<body>
310<div id="header">
311<h1>
312git-push(1) Manual Page
313</h1>
314<h2>NAME</h2>
315<div class="sectionbody">
316<p>git-push -
Junio C Hamano01078922006-03-10 00:31:47317 Update remote refs along with associated objects
Junio C Hamano1a4e8412005-12-27 08:17:23318</p>
319</div>
320</div>
321<h2>SYNOPSIS</h2>
322<div class="sectionbody">
Junio C Hamanoa9b8d242007-05-19 04:51:55323<div class="verseblock">
Junio C Hamano4007b5d2009-02-19 00:54:28324<div class="content"><em>git push</em> [--all | --mirror | --tags] [--dry-run] [--receive-pack=&lt;git-receive-pack&gt;]
Junio C Hamanoa476efa2008-10-10 15:31:42325 [--repo=&lt;repository&gt;] [-f | --force] [-v | --verbose]
Junio C Hamano7f80ae82008-07-30 18:31:35326 [&lt;repository&gt; &lt;refspec&gt;&#8230;]</div></div>
Junio C Hamano1a4e8412005-12-27 08:17:23327</div>
Junio C Hamanoba4b9282008-07-06 05:20:31328<h2 id="_description">DESCRIPTION</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23329<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31330<div class="para"><p>Updates remote refs using local refs, while sending objects
331necessary to complete the given refs.</p></div>
332<div class="para"><p>You can make interesting things happen to a repository
Junio C Hamano1a4e8412005-12-27 08:17:23333every time you push into it, by setting up <em>hooks</em> there. See
Junio C Hamanoba4b9282008-07-06 05:20:31334documentation for <a href="git-receive-pack.html">git-receive-pack(1)</a>.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23335</div>
Junio C Hamanoea82cff2009-03-18 01:54:48336<h2 id="_options_a_id_options_a">OPTIONS<a id="OPTIONS"></a></h2>
Junio C Hamano1a4e8412005-12-27 08:17:23337<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31338<div class="vlist"><dl>
Junio C Hamano1a4e8412005-12-27 08:17:23339<dt>
340&lt;repository&gt;
341</dt>
342<dd>
343<p>
Junio C Hamano40f2f8d2006-02-07 08:04:39344 The "remote" repository that is destination of a push
Junio C Hamanocc0cb312009-01-22 03:38:50345 operation. This parameter can be either a URL
346 (see the section <a href="#URLS">GIT URLS</a> below) or the name
347 of a remote (see the section <a href="#REMOTES">REMOTES</a> below).
Junio C Hamano1a4e8412005-12-27 08:17:23348</p>
Junio C Hamano40f2f8d2006-02-07 08:04:39349</dd>
350<dt>
Junio C Hamano7f80ae82008-07-30 18:31:35351&lt;refspec&gt;&#8230;
Junio C Hamano40f2f8d2006-02-07 08:04:39352</dt>
353<dd>
354<p>
Junio C Hamano8b6e23b2009-02-01 06:36:08355 The format of a &lt;refspec&gt; parameter is an optional plus
356 <tt>&#43;</tt>, followed by the source ref &lt;src&gt;, followed
357 by a colon <tt>:</tt>, followed by the destination ref &lt;dst&gt;.
358 It is used to specify with what &lt;src&gt; object the &lt;dst&gt; ref
359 in the remote repository is to be updated.
Junio C Hamano40f2f8d2006-02-07 08:04:39360</p>
Junio C Hamano8b6e23b2009-02-01 06:36:08361<div class="para"><p>The &lt;src&gt; is often the name of the branch you would want to push, but
362it can be any arbitrary "SHA-1 expression", such as <tt>master~4</tt> or
363<tt>HEAD</tt> (see <a href="git-rev-parse.html">git-rev-parse(1)</a>).</p></div>
364<div class="para"><p>The &lt;dst&gt; tells which ref on the remote side is updated with this
365push. Arbitrary expressions cannot be used here, an actual ref must
366be named. If <tt>:</tt>&lt;dst&gt; is omitted, the same ref as &lt;src&gt; will be
367updated.</p></div>
Junio C Hamanod533bdb2009-02-25 09:56:58368<div class="para"><p>The object referenced by &lt;src&gt; is used to update the &lt;dst&gt; reference
369on the remote side, but by default this is only allowed if the
370update can fast forward &lt;dst&gt;. By having the optional leading <tt>&#43;</tt>,
371you can tell git to update the &lt;dst&gt; ref even when the update is not a
372fast forward. This does <strong>not</strong> attempt to merge &lt;src&gt; into &lt;dst&gt;. See
373EXAMPLES below for details.</p></div>
Junio C Hamanoba4b9282008-07-06 05:20:31374<div class="para"><p><tt>tag &lt;tag&gt;</tt> means the same as <tt>refs/tags/&lt;tag&gt;:refs/tags/&lt;tag&gt;</tt>.</p></div>
Junio C Hamanoba4b9282008-07-06 05:20:31375<div class="para"><p>Pushing an empty &lt;src&gt; allows you to delete the &lt;dst&gt; ref from
376the remote repository.</p></div>
Junio C Hamanod533bdb2009-02-25 09:56:58377<div class="para"><p>The special refspec <tt>:</tt> (or <tt>&#43;:</tt> to allow non-fast forward updates)
Junio C Hamanocc0cb312009-01-22 03:38:50378directs git to push "matching" branches: for every branch that exists on
379the local side, the remote side is updated if a branch of the same name
Junio C Hamanob713ff12008-05-24 01:12:30380already exists on the remote side. This is the default operation mode
381if no explicit refspec is found (that is neither on the command line
Junio C Hamanoba4b9282008-07-06 05:20:31382nor in any Push line of the corresponding remotes file---see below).</p></div>
Junio C Hamano40f2f8d2006-02-07 08:04:39383</dd>
384<dt>
385--all
386</dt>
387<dd>
388<p>
389 Instead of naming each ref to push, specifies that all
Junio C Hamanod2d9ae12007-09-19 02:27:57390 refs under <tt>$GIT_DIR/refs/heads/</tt> be pushed.
Junio C Hamano40f2f8d2006-02-07 08:04:39391</p>
392</dd>
393<dt>
Junio C Hamano9d2bbb72007-11-25 04:56:07394--mirror
395</dt>
396<dd>
397<p>
398 Instead of naming each ref to push, specifies that all
Junio C Hamanoa351d142008-06-21 09:40:40399 refs under <tt>$GIT_DIR/refs/</tt> (which includes but is not
400 limited to <tt>refs/heads/</tt>, <tt>refs/remotes/</tt>, and <tt>refs/tags/</tt>)
Junio C Hamano9d2bbb72007-11-25 04:56:07401 be mirrored to the remote repository. Newly created local
402 refs will be pushed to the remote end, locally updated refs
403 will be force updated on the remote end, and deleted refs
Junio C Hamano47d68a52008-05-06 06:35:40404 will be removed from the remote end. This is the default
405 if the configuration option <tt>remote.&lt;remote&gt;.mirror</tt> is
406 set.
Junio C Hamano9d2bbb72007-11-25 04:56:07407</p>
408</dd>
409<dt>
Junio C Hamano764a6672007-10-23 01:23:31410--dry-run
411</dt>
412<dd>
413<p>
414 Do everything except actually send the updates.
415</p>
416</dd>
417<dt>
Junio C Hamano48bc1ce2009-07-09 16:49:19418--porcelain
419</dt>
420<dd>
421<p>
422 Produce machine-readable output. The output status line for each ref
423 will be tab-separated and sent to stdout instead of stderr. The full
424 symbolic names of the refs will be given.
425</p>
426</dd>
427<dt>
Junio C Hamano40f2f8d2006-02-07 08:04:39428--tags
429</dt>
430<dd>
431<p>
432 All refs under <tt>$GIT_DIR/refs/tags</tt> are pushed, in
433 addition to refspecs explicitly listed on the command
434 line.
435</p>
436</dd>
437<dt>
Junio C Hamano4ad294b2007-01-20 02:22:50438--receive-pack=&lt;git-receive-pack&gt;
Junio C Hamano1ce39ab2007-01-16 22:05:10439</dt>
Junio C Hamano1c958272009-01-12 18:04:21440<dt>
441--exec=&lt;git-receive-pack&gt;
442</dt>
Junio C Hamano1ce39ab2007-01-16 22:05:10443<dd>
444<p>
Junio C Hamanoba4b9282008-07-06 05:20:31445 Path to the <em>git-receive-pack</em> program on the remote
Junio C Hamano1ce39ab2007-01-16 22:05:10446 end. Sometimes useful when pushing to a remote
447 repository over ssh, and you do not have the program in
448 a directory on the default $PATH.
449</p>
450</dd>
451<dt>
Junio C Hamanoeb415992008-06-08 22:49:47452-f
453</dt>
454<dt>
455--force
Junio C Hamano40f2f8d2006-02-07 08:04:39456</dt>
457<dd>
458<p>
459 Usually, the command refuses to update a remote ref that is
Junio C Hamano4cd1c0e2007-08-06 04:39:14460 not an ancestor of the local ref used to overwrite it.
Junio C Hamano40f2f8d2006-02-07 08:04:39461 This flag disables the check. This can cause the
462 remote repository to lose commits; use it with care.
463</p>
464</dd>
Junio C Hamano1ce39ab2007-01-16 22:05:10465<dt>
Junio C Hamanoa476efa2008-10-10 15:31:42466--repo=&lt;repository&gt;
Junio C Hamano1ce39ab2007-01-16 22:05:10467</dt>
468<dd>
469<p>
Junio C Hamanoa476efa2008-10-10 15:31:42470 This option is only relevant if no &lt;repository&gt; argument is
471 passed in the invocation. In this case, <em>git-push</em> derives the
472 remote name from the current branch: If it tracks a remote
473 branch, then that remote repository is pushed to. Otherwise,
474 the name "origin" is used. For this latter case, this option
475 can be used to override the name "origin". In other words,
476 the difference between these two commands
Junio C Hamano1ce39ab2007-01-16 22:05:10477</p>
Junio C Hamanoa476efa2008-10-10 15:31:42478<div class="listingblock">
479<div class="content">
480<pre><tt>git push public #1
481git push --repo=public #2</tt></pre>
482</div></div>
483<div class="para"><p>is that #1 always pushes to "public" whereas #2 pushes to "public"
484only if the current branch does not track a remote branch. This is
485useful if you write an alias or script around <em>git-push</em>.</p></div>
Junio C Hamano1ce39ab2007-01-16 22:05:10486</dd>
487<dt>
Junio C Hamanoeb415992008-06-08 22:49:47488--thin
489</dt>
490<dt>
491--no-thin
Junio C Hamano1ce39ab2007-01-16 22:05:10492</dt>
493<dd>
494<p>
Junio C Hamanoba4b9282008-07-06 05:20:31495 These options are passed to <em>git-send-pack</em>. Thin
Junio C Hamano1ce39ab2007-01-16 22:05:10496 transfer spends extra cycles to minimize the number of
497 objects to be sent and meant to be used on slower connection.
498</p>
499</dd>
500<dt>
Junio C Hamanoeb415992008-06-08 22:49:47501-v
502</dt>
503<dt>
504--verbose
Junio C Hamano1ce39ab2007-01-16 22:05:10505</dt>
506<dd>
507<p>
508 Run verbosely.
509</p>
510</dd>
Junio C Hamanoba4b9282008-07-06 05:20:31511</dl></div>
Junio C Hamano40f2f8d2006-02-07 08:04:39512</div>
Junio C Hamanoba4b9282008-07-06 05:20:31513<h2 id="_git_urls_a_id_urls_a">GIT URLS<a id="URLS"></a></h2>
Junio C Hamano40f2f8d2006-02-07 08:04:39514<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31515<div class="para"><p>One of the following notations can be used
516to name the remote repository:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23517<div class="exampleblock">
518<div class="exampleblock-content">
Junio C Hamanoba4b9282008-07-06 05:20:31519<div class="ilist"><ul>
Junio C Hamano1a4e8412005-12-27 08:17:23520<li>
521<p>
522rsync://host.xz/path/to/repo.git/
523</p>
524</li>
525<li>
526<p>
Junio C Hamanoa3bb6eb2009-02-05 01:26:33527http://host.xz&#91;:port&#93;/path/to/repo.git/
Junio C Hamano1a4e8412005-12-27 08:17:23528</p>
529</li>
530<li>
531<p>
Junio C Hamanoa3bb6eb2009-02-05 01:26:33532https://host.xz&#91;:port&#93;/path/to/repo.git/
Junio C Hamano1a4e8412005-12-27 08:17:23533</p>
534</li>
535<li>
536<p>
Junio C Hamanoa3bb6eb2009-02-05 01:26:33537git://host.xz&#91;:port&#93;/path/to/repo.git/
Junio C Hamano1a4e8412005-12-27 08:17:23538</p>
539</li>
540<li>
541<p>
Junio C Hamanoa3bb6eb2009-02-05 01:26:33542git://host.xz&#91;:port&#93;/~user/path/to/repo.git/
Junio C Hamano1a4e8412005-12-27 08:17:23543</p>
544</li>
545<li>
546<p>
Junio C Hamanodbb64592007-09-01 11:17:39547ssh://&#91;user@&#93;host.xz&#91;:port&#93;/path/to/repo.git/
548</p>
549</li>
550<li>
551<p>
Junio C Hamano7ccb9fd2006-07-15 01:38:40552ssh://&#91;user@&#93;host.xz/path/to/repo.git/
Junio C Hamano1a4e8412005-12-27 08:17:23553</p>
554</li>
555<li>
556<p>
Junio C Hamano7ccb9fd2006-07-15 01:38:40557ssh://&#91;user@&#93;host.xz/~user/path/to/repo.git/
Junio C Hamano1a4e8412005-12-27 08:17:23558</p>
559</li>
560<li>
561<p>
Junio C Hamano7ccb9fd2006-07-15 01:38:40562ssh://&#91;user@&#93;host.xz/~/path/to/repo.git
Junio C Hamano1a4e8412005-12-27 08:17:23563</p>
564</li>
Junio C Hamanoba4b9282008-07-06 05:20:31565</ul></div>
Junio C Hamano1a4e8412005-12-27 08:17:23566</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31567<div class="para"><p>SSH is the default transport protocol over the network. You can
Junio C Hamanob1d6e882007-08-11 08:30:16568optionally specify which user to log-in as, and an alternate,
569scp-like syntax is also supported. Both syntaxes support
Junio C Hamanodbb64592007-09-01 11:17:39570username expansion, as does the native git protocol, but
571only the former supports port specification. The following
Junio C Hamanoba4b9282008-07-06 05:20:31572three are identical to the last three above, respectively:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23573<div class="exampleblock">
574<div class="exampleblock-content">
Junio C Hamanoba4b9282008-07-06 05:20:31575<div class="ilist"><ul>
Junio C Hamano1a4e8412005-12-27 08:17:23576<li>
577<p>
Junio C Hamano7ccb9fd2006-07-15 01:38:40578&#91;user@&#93;host.xz:/path/to/repo.git/
Junio C Hamano1a4e8412005-12-27 08:17:23579</p>
580</li>
581<li>
582<p>
Junio C Hamano7ccb9fd2006-07-15 01:38:40583&#91;user@&#93;host.xz:~user/path/to/repo.git/
Junio C Hamano1a4e8412005-12-27 08:17:23584</p>
585</li>
586<li>
587<p>
Junio C Hamano7ccb9fd2006-07-15 01:38:40588&#91;user@&#93;host.xz:path/to/repo.git
Junio C Hamano1a4e8412005-12-27 08:17:23589</p>
590</li>
Junio C Hamanoba4b9282008-07-06 05:20:31591</ul></div>
Junio C Hamano1a4e8412005-12-27 08:17:23592</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31593<div class="para"><p>To sync with a local directory, you can use:</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23594<div class="exampleblock">
595<div class="exampleblock-content">
Junio C Hamanoba4b9282008-07-06 05:20:31596<div class="ilist"><ul>
Junio C Hamano1a4e8412005-12-27 08:17:23597<li>
598<p>
599/path/to/repo.git/
600</p>
601</li>
Junio C Hamanob1d6e882007-08-11 08:30:16602<li>
603<p>
604file:///path/to/repo.git/
605</p>
606</li>
Junio C Hamanoba4b9282008-07-06 05:20:31607</ul></div>
Junio C Hamano1a4e8412005-12-27 08:17:23608</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31609<div class="para"><p>They are mostly equivalent, except when cloning. See
610<a href="git-clone.html">git-clone(1)</a> for details.</p></div>
611<div class="para"><p>If there are a large number of similarly-named remote repositories and
Junio C Hamano24bc09a2008-02-28 00:27:44612you want to use a different format for them (such that the URLs you
613use will be rewritten into URLs that work), you can create a
Junio C Hamanoba4b9282008-07-06 05:20:31614configuration section of the form:</p></div>
Junio C Hamano24bc09a2008-02-28 00:27:44615<div class="listingblock">
616<div class="content">
617<pre><tt> [url "&lt;actual url base&gt;"]
618 insteadOf = &lt;other url base&gt;</tt></pre>
619</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31620<div class="para"><p>For example, with this:</p></div>
Junio C Hamano24bc09a2008-02-28 00:27:44621<div class="listingblock">
622<div class="content">
623<pre><tt> [url "git://git.host.xz/"]
624 insteadOf = host.xz:/path/to/
625 insteadOf = work:</tt></pre>
626</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31627<div class="para"><p>a URL like "work:repo.git" or like "host.xz:/path/to/repo.git" will be
628rewritten in any context that takes a URL to be "git://git.host.xz/repo.git".</p></div>
Junio C Hamano7df6dcf2009-09-13 09:51:17629<div class="para"><p>If you want to rewrite URLs for push only, you can create a
630configuration section of the form:</p></div>
631<div class="listingblock">
632<div class="content">
633<pre><tt> [url "&lt;actual url base&gt;"]
634 pushInsteadOf = &lt;other url base&gt;</tt></pre>
635</div></div>
636<div class="para"><p>For example, with this:</p></div>
637<div class="listingblock">
638<div class="content">
639<pre><tt> [url "ssh://example.org/"]
640 pushInsteadOf = git://example.org/</tt></pre>
641</div></div>
642<div class="para"><p>a URL like "git://example.org/path/to/repo.git" will be rewritten to
643"ssh://example.org/path/to/repo.git" for pushes, but pulls will still
644use the original URL.</p></div>
Junio C Hamano40f2f8d2006-02-07 08:04:39645</div>
Junio C Hamanoba4b9282008-07-06 05:20:31646<h2 id="_remotes_a_id_remotes_a">REMOTES<a id="REMOTES"></a></h2>
Junio C Hamano40f2f8d2006-02-07 08:04:39647<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31648<div class="para"><p>The name of one of the following can be used instead
649of a URL as <tt>&lt;repository&gt;</tt> argument:</p></div>
650<div class="ilist"><ul>
Junio C Hamano054ea082008-06-01 08:26:34651<li>
652<p>
653a remote in the git configuration file: <tt>$GIT_DIR/config</tt>,
654</p>
655</li>
656<li>
657<p>
658a file in the <tt>$GIT_DIR/remotes</tt> directory, or
659</p>
660</li>
661<li>
662<p>
663a file in the <tt>$GIT_DIR/branches</tt> directory.
664</p>
665</li>
Junio C Hamanoba4b9282008-07-06 05:20:31666</ul></div>
667<div class="para"><p>All of these also allow you to omit the refspec from the command line
668because they each contain a refspec which git will use by default.</p></div>
669<h3 id="_named_remote_in_configuration_file">Named remote in configuration file</h3><div style="clear:left"></div>
670<div class="para"><p>You can choose to provide the name of a remote which you had previously
Junio C Hamano054ea082008-06-01 08:26:34671configured using <a href="git-remote.html">git-remote(1)</a>, <a href="git-config.html">git-config(1)</a>
672or even by a manual edit to the <tt>$GIT_DIR/config</tt> file. The URL of
673this remote will be used to access the repository. The refspec
674of this remote will be used by default when you do
675not provide a refspec on the command line. The entry in the
Junio C Hamanoba4b9282008-07-06 05:20:31676config file would appear like this:</p></div>
Junio C Hamano054ea082008-06-01 08:26:34677<div class="listingblock">
678<div class="content">
679<pre><tt> [remote "&lt;name&gt;"]
680 url = &lt;url&gt;
Junio C Hamano0e88f3e2009-06-21 08:03:25681 pushurl = &lt;pushurl&gt;
Junio C Hamano054ea082008-06-01 08:26:34682 push = &lt;refspec&gt;
683 fetch = &lt;refspec&gt;</tt></pre>
684</div></div>
Junio C Hamano0e88f3e2009-06-21 08:03:25685<div class="para"><p>The <tt>&lt;pushurl&gt;</tt> is used for pushes only. It is optional and defaults
686to <tt>&lt;url&gt;</tt>.</p></div>
Junio C Hamanoba4b9282008-07-06 05:20:31687<h3 id="_named_file_in_tt_git_dir_remotes_tt">Named file in <tt>$GIT_DIR/remotes</tt></h3><div style="clear:left"></div>
688<div class="para"><p>You can choose to provide the name of a
Junio C Hamano054ea082008-06-01 08:26:34689file in <tt>$GIT_DIR/remotes</tt>. The URL
690in this file will be used to access the repository. The refspec
691in this file will be used as default when you do not
692provide a refspec on the command line. This file should have the
Junio C Hamanoba4b9282008-07-06 05:20:31693following format:</p></div>
Junio C Hamano1caaf472006-12-31 08:29:35694<div class="listingblock">
Junio C Hamano1a4e8412005-12-27 08:17:23695<div class="content">
Junio C Hamanod3361ad2007-01-01 03:20:24696<pre><tt> URL: one of the above URL format
697 Push: &lt;refspec&gt;
698 Pull: &lt;refspec&gt;
699</tt></pre>
Junio C Hamano1a4e8412005-12-27 08:17:23700</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31701<div class="para"><p><tt>Push:</tt> lines are used by <em>git-push</em> and
702<tt>Pull:</tt> lines are used by <em>git-pull</em> and <em>git-fetch</em>.
Junio C Hamano054ea082008-06-01 08:26:34703Multiple <tt>Push:</tt> and <tt>Pull:</tt> lines may
Junio C Hamanoba4b9282008-07-06 05:20:31704be specified for additional branch mappings.</p></div>
705<h3 id="_named_file_in_tt_git_dir_branches_tt">Named file in <tt>$GIT_DIR/branches</tt></h3><div style="clear:left"></div>
706<div class="para"><p>You can choose to provide the name of a
Junio C Hamano054ea082008-06-01 08:26:34707file in <tt>$GIT_DIR/branches</tt>.
708The URL in this file will be used to access the repository.
Junio C Hamanoba4b9282008-07-06 05:20:31709This file should have the following format:</p></div>
Junio C Hamano1caaf472006-12-31 08:29:35710<div class="listingblock">
Junio C Hamano249572f2006-10-24 05:44:08711<div class="content">
Junio C Hamano054ea082008-06-01 08:26:34712<pre><tt> &lt;url&gt;#&lt;head&gt;</tt></pre>
Junio C Hamano249572f2006-10-24 05:44:08713</div></div>
Junio C Hamano28363492008-11-14 08:26:31714<div class="para"><p><tt>&lt;url&gt;</tt> is required; <tt>#&lt;head&gt;</tt> is optional.</p></div>
715<div class="para"><p>Depending on the operation, git will use one of the following
716refspecs, if you don't provide one on the command line.
717<tt>&lt;branch&gt;</tt> is the name of this file in <tt>$GIT_DIR/branches</tt> and
718<tt>&lt;head&gt;</tt> defaults to <tt>master</tt>.</p></div>
719<div class="para"><p>git fetch uses:</p></div>
Junio C Hamano1caaf472006-12-31 08:29:35720<div class="listingblock">
Junio C Hamano1a4e8412005-12-27 08:17:23721<div class="content">
Junio C Hamano28363492008-11-14 08:26:31722<pre><tt> refs/heads/&lt;head&gt;:refs/heads/&lt;branch&gt;</tt></pre>
723</div></div>
724<div class="para"><p>git push uses:</p></div>
725<div class="listingblock">
726<div class="content">
727<pre><tt> HEAD:refs/heads/&lt;head&gt;</tt></pre>
Junio C Hamano1a4e8412005-12-27 08:17:23728</div></div>
Junio C Hamano1a4e8412005-12-27 08:17:23729</div>
Junio C Hamanoba4b9282008-07-06 05:20:31730<h2 id="_output">OUTPUT</h2>
Junio C Hamano6d559fc2008-02-20 10:44:26731<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31732<div class="para"><p>The output of "git push" depends on the transport method used; this
Junio C Hamano6d559fc2008-02-20 10:44:26733section describes the output when pushing over the git protocol (either
Junio C Hamanoba4b9282008-07-06 05:20:31734locally or via ssh).</p></div>
735<div class="para"><p>The status of the push is output in tabular form, with each line
736representing the status of a single ref. Each line is of the form:</p></div>
Junio C Hamano6d559fc2008-02-20 10:44:26737<div class="listingblock">
738<div class="content">
739<pre><tt> &lt;flag&gt; &lt;summary&gt; &lt;from&gt; -&gt; &lt;to&gt; (&lt;reason&gt;)</tt></pre>
740</div></div>
Junio C Hamano48bc1ce2009-07-09 16:49:19741<div class="para"><p>If --porcelain is used, then each line of the output is of the form:</p></div>
742<div class="listingblock">
743<div class="content">
744<pre><tt> &lt;flag&gt; \t &lt;from&gt;:&lt;to&gt; \t &lt;summary&gt; (&lt;reason&gt;)</tt></pre>
745</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31746<div class="vlist"><dl>
Junio C Hamano6d559fc2008-02-20 10:44:26747<dt>
748flag
749</dt>
750<dd>
751<p>
752 A single character indicating the status of the ref. This is
753 blank for a successfully pushed ref, <tt>!</tt> for a ref that was
754 rejected or failed to push, and <em>=</em> for a ref that was up to
755 date and did not need pushing (note that the status of up to
756 date refs is shown only when <tt>git push</tt> is running verbosely).
757</p>
758</dd>
759<dt>
760summary
761</dt>
762<dd>
763<p>
764 For a successfully pushed ref, the summary shows the old and new
765 values of the ref in a form suitable for using as an argument to
766 <tt>git log</tt> (this is <tt>&lt;old&gt;..&lt;new&gt;</tt> in most cases, and
767 <tt>&lt;old&gt;&#8230;&lt;new&gt;</tt> for forced non-fast forward updates). For a
768 failed update, more details are given for the failure.
769 The string <tt>rejected</tt> indicates that git did not try to send the
770 ref at all (typically because it is not a fast forward). The
771 string <tt>remote rejected</tt> indicates that the remote end refused
772 the update; this rejection is typically caused by a hook on the
773 remote side. The string <tt>remote failure</tt> indicates that the
774 remote end did not report the successful update of the ref
775 (perhaps because of a temporary error on the remote side, a
776 break in the network connection, or other transient error).
777</p>
778</dd>
779<dt>
780from
781</dt>
782<dd>
783<p>
784 The name of the local ref being pushed, minus its
785 <tt>refs/&lt;type&gt;/</tt> prefix. In the case of deletion, the
786 name of the local ref is omitted.
787</p>
788</dd>
789<dt>
790to
791</dt>
792<dd>
793<p>
794 The name of the remote ref being updated, minus its
795 <tt>refs/&lt;type&gt;/</tt> prefix.
796</p>
797</dd>
798<dt>
799reason
800</dt>
801<dd>
802<p>
803 A human-readable explanation. In the case of successfully pushed
804 refs, no explanation is needed. For a failed ref, the reason for
805 failure is described.
806</p>
807</dd>
Junio C Hamanoba4b9282008-07-06 05:20:31808</dl></div>
Junio C Hamano6d559fc2008-02-20 10:44:26809</div>
Junio C Hamano27a128b2009-08-13 01:23:00810<h2 id="_note_about_fast_forwards">Note about fast-forwards</h2>
811<div class="sectionbody">
812<div class="para"><p>When an update changes a branch (or more in general, a ref) that used to
813point at commit A to point at another commit B, it is called a
814fast-forward update if and only if B is a descendant of A.</p></div>
815<div class="para"><p>In a fast-forward update from A to B, the set of commits that the original
816commit A built on top of is a subset of the commits the new commit B
817builds on top of. Hence, it does not lose any history.</p></div>
818<div class="para"><p>In contrast, a non-fast-forward update will lose history. For example,
819suppose you and somebody else started at the same commit X, and you built
820a history leading to commit B while the other person built a history
821leading to commit A. The history looks like this:</p></div>
822<div class="listingblock">
823<div class="content">
824<pre><tt>
825 B
826 /
827 ---X---A
828</tt></pre>
829</div></div>
830<div class="para"><p>Further suppose that the other person already pushed changes leading to A
831back to the original repository you two obtained the original commit X.</p></div>
832<div class="para"><p>The push done by the other person updated the branch that used to point at
833commit X to point at commit A. It is a fast-forward.</p></div>
834<div class="para"><p>But if you try to push, you will attempt to update the branch (that
835now points at A) with commit B. This does _not_ fast-forward. If you did
836so, the changes introduced by commit A will be lost, because everybody
837will now start building on top of B.</p></div>
838<div class="para"><p>The command by default does not allow an update that is not a fast-forward
839to prevent such loss of history.</p></div>
840<div class="para"><p>If you do not want to lose your work (history from X to B) nor the work by
841the other person (history from X to A), you would need to first fetch the
842history from the repository, create a history that contains changes done
843by both parties, and push the result back.</p></div>
844<div class="para"><p>You can perform "git pull", resolve potential conflicts, and "git push"
845the result. A "git pull" will create a merge commit C between commits A
846and B.</p></div>
847<div class="listingblock">
848<div class="content">
849<pre><tt>
850 B---C
851 / /
852 ---X---A
853</tt></pre>
854</div></div>
855<div class="para"><p>Updating A with the resulting merge commit will fast-forward and your
856push will be accepted.</p></div>
857<div class="para"><p>Alternatively, you can rebase your change between X and B on top of A,
858with "git pull --rebase", and push the result back. The rebase will
859create a new commit D that builds the change between X and B on top of
860A.</p></div>
861<div class="listingblock">
862<div class="content">
863<pre><tt>
864 B D
865 / /
866 ---X---A
867</tt></pre>
868</div></div>
869<div class="para"><p>Again, updating A with this commit will fast-forward and your push will be
870accepted.</p></div>
871<div class="para"><p>There is another common situation where you may encounter non-fast-forward
872rejection when you try to push, and it is possible even when you are
873pushing into a repository nobody else pushes into. After you push commit
874A yourself (in the first picture in this section), replace it with "git
875commit --amend" to produce commit B, and you try to push it out, because
876forgot that you have pushed A out already. In such a case, and only if
877you are certain that nobody in the meantime fetched your earlier commit A
878(and started building on top of it), you can run "git push --force" to
879overwrite it. In other words, "git push --force" is a method reserved for
880a case where you do mean to lose history.</p></div>
881</div>
Junio C Hamanoba4b9282008-07-06 05:20:31882<h2 id="_examples">Examples</h2>
Junio C Hamano6926bef2007-06-16 09:54:05883<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31884<div class="vlist"><dl>
Junio C Hamano6926bef2007-06-16 09:54:05885<dt>
Junio C Hamanoea82cff2009-03-18 01:54:48886git push
887</dt>
888<dd>
889<p>
890 Works like <tt>git push &lt;remote&gt;</tt>, where &lt;remote&gt; is the
891 current branch's remote (or <tt>origin</tt>, if no remote is
892 configured for the current branch).
893</p>
894</dd>
895<dt>
896git push origin
897</dt>
898<dd>
899<p>
900 Without additional configuration, works like
901 <tt>git push origin :</tt>.
902</p>
903<div class="para"><p>The default behavior of this command when no &lt;refspec&gt; is given can be
904configured by setting the <tt>push</tt> option of the remote.</p></div>
905<div class="para"><p>For example, to default to pushing only the current branch to <tt>origin</tt>
906use <tt>git config remote.origin.push HEAD</tt>. Any valid &lt;refspec&gt; (like
907the ones in the examples below) can be configured as the default for
908<tt>git push origin</tt>.</p></div>
909</dd>
910<dt>
911git push origin :
912</dt>
913<dd>
914<p>
915 Push "matching" branches to <tt>origin</tt>. See
916 &lt;refspec&gt; in the <a href="#OPTIONS">OPTIONS</a> section above for a
917 description of "matching" branches.
918</p>
919</dd>
920<dt>
Junio C Hamano6926bef2007-06-16 09:54:05921git push origin master
922</dt>
923<dd>
924<p>
925 Find a ref that matches <tt>master</tt> in the source repository
926 (most likely, it would find <tt>refs/heads/master</tt>), and update
927 the same ref (e.g. <tt>refs/heads/master</tt>) in <tt>origin</tt> repository
Junio C Hamanoa9aee782008-04-23 16:09:20928 with it. If <tt>master</tt> did not exist remotely, it would be
929 created.
Junio C Hamano6926bef2007-06-16 09:54:05930</p>
931</dd>
932<dt>
Junio C Hamano8b6e23b2009-02-01 06:36:08933git push origin HEAD
Junio C Hamano6926bef2007-06-16 09:54:05934</dt>
935<dd>
936<p>
Junio C Hamano8b6e23b2009-02-01 06:36:08937 A handy way to push the current branch to the same name on the
938 remote.
Junio C Hamano6926bef2007-06-16 09:54:05939</p>
940</dd>
941<dt>
Junio C Hamano7f80ae82008-07-30 18:31:35942git push origin master:satellite/master dev:satellite/dev
Junio C Hamano6926bef2007-06-16 09:54:05943</dt>
944<dd>
945<p>
Junio C Hamano7f80ae82008-07-30 18:31:35946 Use the source ref that matches <tt>master</tt> (e.g. <tt>refs/heads/master</tt>)
947 to update the ref that matches <tt>satellite/master</tt> (most probably
948 <tt>refs/remotes/satellite/master</tt>) in the <tt>origin</tt> repository, then
949 do the same for <tt>dev</tt> and <tt>satellite/dev</tt>.
Junio C Hamano6926bef2007-06-16 09:54:05950</p>
951</dd>
Junio C Hamanobfd4f9a2007-09-06 08:52:44952<dt>
Junio C Hamano8b6e23b2009-02-01 06:36:08953git push origin HEAD:master
954</dt>
955<dd>
956<p>
957 Push the current branch to the remote ref matching <tt>master</tt> in the
958 <tt>origin</tt> repository. This form is convenient to push the current
959 branch without thinking about its local name.
960</p>
961</dd>
962<dt>
Junio C Hamanobfd4f9a2007-09-06 08:52:44963git push origin master:refs/heads/experimental
964</dt>
965<dd>
966<p>
967 Create the branch <tt>experimental</tt> in the <tt>origin</tt> repository
Junio C Hamanoa9aee782008-04-23 16:09:20968 by copying the current <tt>master</tt> branch. This form is only
969 needed to create a new branch or tag in the remote repository when
970 the local name and the remote name are different; otherwise,
971 the ref name on its own will work.
Junio C Hamanobfd4f9a2007-09-06 08:52:44972</p>
973</dd>
Junio C Hamano8b6e23b2009-02-01 06:36:08974<dt>
975git push origin :experimental
976</dt>
977<dd>
978<p>
979 Find a ref that matches <tt>experimental</tt> in the <tt>origin</tt> repository
980 (e.g. <tt>refs/heads/experimental</tt>), and delete it.
981</p>
982</dd>
Junio C Hamanod533bdb2009-02-25 09:56:58983<dt>
984git push origin &#43;dev:master
985</dt>
986<dd>
987<p>
988 Update the origin repository's master branch with the dev branch,
989 allowing non-fast forward updates. <strong>This can leave unreferenced
990 commits dangling in the origin repository.</strong> Consider the
991 following situation, where a fast forward is not possible:
992</p>
993<div class="listingblock">
994<div class="content">
995<pre><tt> o---o---o---A---B origin/master
996 \
997 X---Y---Z dev</tt></pre>
998</div></div>
999<div class="para"><p>The above command would change the origin repository to</p></div>
1000<div class="listingblock">
1001<div class="content">
1002<pre><tt> A---B (unnamed branch)
1003 /
1004 o---o---o---X---Y---Z master</tt></pre>
1005</div></div>
1006<div class="para"><p>Commits A and B would no longer belong to a branch with a symbolic name,
1007and so would be unreachable. As such, these commits would be removed by
1008a <tt>git gc</tt> command on the origin repository.</p></div>
1009</dd>
Junio C Hamanoba4b9282008-07-06 05:20:311010</dl></div>
Junio C Hamano6926bef2007-06-16 09:54:051011</div>
Junio C Hamanoba4b9282008-07-06 05:20:311012<h2 id="_author">Author</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231013<div class="sectionbody">
Junio C Hamano0868a302008-07-22 09:20:441014<div class="para"><p>Written by Junio C Hamano &lt;gitster@pobox.com&gt;, later rewritten in C
Junio C Hamanoba4b9282008-07-06 05:20:311015by Linus Torvalds &lt;torvalds@osdl.org&gt;</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231016</div>
Junio C Hamanoba4b9282008-07-06 05:20:311017<h2 id="_documentation">Documentation</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231018<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:311019<div class="para"><p>Documentation by Junio C Hamano and the git-list &lt;git@vger.kernel.org&gt;.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231020</div>
Junio C Hamanoba4b9282008-07-06 05:20:311021<h2 id="_git">GIT</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231022<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:311023<div class="para"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231024</div>
1025<div id="footer">
1026<div id="footer-text">
Junio C Hamano7df6dcf2009-09-13 09:51:171027Last updated 2009-09-13 09:50:54 UTC
Junio C Hamano1a4e8412005-12-27 08:17:231028</div>
1029</div>
1030</body>
1031</html>