Autogenerated HTML docs for v1.7.1-78-g212f0
[git/jnareb-git.git] / git-push.html
blobd8f0a095f9a826f863d201dcc1f6c010caadf013
1 <!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" />
6 <meta name="generator" content="AsciiDoc 8.2.5" />
7 <style type="text/css">
8 /* Debug borders */
9 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
11 border: 1px solid red;
15 body {
16 margin: 1em 5% 1em 5%;
19 a {
20 color: blue;
21 text-decoration: underline;
23 a:visited {
24 color: fuchsia;
27 em {
28 font-style: italic;
31 strong {
32 font-weight: bold;
35 tt {
36 color: navy;
39 h1, 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;
47 h1, h2, h3 {
48 border-bottom: 2px solid silver;
50 h2 {
51 padding-top: 0.5em;
53 h3 {
54 float: left;
56 h3 + * {
57 clear: left;
60 div.sectionbody {
61 font-family: serif;
62 margin-left: 0;
65 hr {
66 border: 1px solid silver;
69 p {
70 margin-top: 0.5em;
71 margin-bottom: 0.5em;
74 pre {
75 padding: 0;
76 margin: 0;
79 span#author {
80 color: #527bbd;
81 font-family: sans-serif;
82 font-weight: bold;
83 font-size: 1.1em;
85 span#email {
87 span#revision {
88 font-family: sans-serif;
91 div#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;
98 div#footer-text {
99 float: left;
100 padding-bottom: 0.5em;
102 div#footer-badges {
103 float: right;
104 padding-bottom: 0.5em;
107 div#preamble,
108 div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
109 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
110 div.admonitionblock {
111 margin-right: 10%;
112 margin-top: 1.5em;
113 margin-bottom: 1.5em;
115 div.admonitionblock {
116 margin-top: 2.5em;
117 margin-bottom: 2.5em;
120 div.content { /* Block element content. */
121 padding: 0;
124 /* Block element titles. */
125 div.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;
132 div.title + * {
133 margin-top: 0;
136 td div.title:first-child {
137 margin-top: 0.0em;
139 div.content div.title:first-child {
140 margin-top: 0.0em;
142 div.content + div.title {
143 margin-top: 0.0em;
146 div.sidebarblock > div.content {
147 background: #ffffee;
148 border: 1px solid silver;
149 padding: 0.5em;
152 div.listingblock {
153 margin-right: 0%;
155 div.listingblock > div.content {
156 border: 1px solid silver;
157 background: #f4f4f4;
158 padding: 0.5em;
161 div.quoteblock > div.content {
162 padding-left: 2.0em;
165 div.attribution {
166 text-align: right;
168 div.verseblock + div.attribution {
169 text-align: left;
172 div.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;
180 div.admonitionblock td.content {
181 padding-left: 0.5em;
182 border-left: 2px solid silver;
185 div.exampleblock > div.content {
186 border-left: 2px solid silver;
187 padding: 0.5em;
190 div.verseblock div.content {
191 white-space: pre;
194 div.imageblock div.content { padding-left: 0; }
195 div.imageblock img { border: 1px solid silver; }
196 span.image img { border-style: none; }
198 dl {
199 margin-top: 0.8em;
200 margin-bottom: 0.8em;
202 dt {
203 margin-top: 0.5em;
204 margin-bottom: 0;
205 font-style: italic;
207 dd > *:first-child {
208 margin-top: 0;
211 ul, ol {
212 list-style-position: outside;
214 div.olist2 ol {
215 list-style-type: lower-alpha;
218 div.tableblock > table {
219 border: 3px solid #527bbd;
221 thead {
222 font-family: sans-serif;
223 font-weight: bold;
225 tfoot {
226 font-weight: bold;
229 div.hlist {
230 margin-top: 0.8em;
231 margin-bottom: 0.8em;
233 div.hlist td {
234 padding-bottom: 5px;
236 td.hlist1 {
237 vertical-align: top;
238 font-style: italic;
239 padding-right: 0.8em;
241 td.hlist2 {
242 vertical-align: top;
245 @media print {
246 div#footer-badges { display: none; }
249 div#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;
258 div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
259 margin-top: 0;
260 margin-bottom: 0;
262 div.toclevel2 {
263 margin-left: 2em;
264 font-size: 0.9em;
266 div.toclevel3 {
267 margin-left: 4em;
268 font-size: 0.9em;
270 div.toclevel4 {
271 margin-left: 6em;
272 font-size: 0.9em;
274 include1::./stylesheets/xhtml11-manpage.css[]
275 /* Workarounds for IE6's broken and incomplete CSS2. */
277 div.sidebar-content {
278 background: #ffffee;
279 border: 1px solid silver;
280 padding: 0.5em;
282 div.sidebar-title, div.image-title {
283 font-family: sans-serif;
284 font-weight: bold;
285 margin-top: 0.0em;
286 margin-bottom: 0.5em;
289 div.listingblock div.content {
290 border: 1px solid silver;
291 background: #f4f4f4;
292 padding: 0.5em;
295 div.quoteblock-content {
296 padding-left: 2.0em;
299 div.exampleblock-content {
300 border-left: 2px solid silver;
301 padding-left: 0.5em;
304 /* IE6 sets dynamically generated links as visited. */
305 div#toc a:visited { color: blue; }
306 </style>
307 <title>git-push(1)</title>
308 </head>
309 <body>
310 <div id="header">
311 <h1>
312 git-push(1) Manual Page
313 </h1>
314 <h2>NAME</h2>
315 <div class="sectionbody">
316 <p>git-push -
317 Update remote refs along with associated objects
318 </p>
319 </div>
320 </div>
321 <h2>SYNOPSIS</h2>
322 <div class="sectionbody">
323 <div class="verseblock">
324 <div class="content"><em>git push</em> [--all | --mirror | --tags] [-n | --dry-run] [--receive-pack=&lt;git-receive-pack&gt;]
325 [--repo=&lt;repository&gt;] [-f | --force] [-v | --verbose] [-u | --set-upstream]
326 [&lt;repository&gt; [&lt;refspec&gt;&#8230;]]</div></div>
327 </div>
328 <h2 id="_description">DESCRIPTION</h2>
329 <div class="sectionbody">
330 <div class="para"><p>Updates remote refs using local refs, while sending objects
331 necessary to complete the given refs.</p></div>
332 <div class="para"><p>You can make interesting things happen to a repository
333 every time you push into it, by setting up <em>hooks</em> there. See
334 documentation for <a href="git-receive-pack.html">git-receive-pack(1)</a>.</p></div>
335 </div>
336 <h2 id="_options_a_id_options_a">OPTIONS<a id="OPTIONS"></a></h2>
337 <div class="sectionbody">
338 <div class="vlist"><dl>
339 <dt>
340 &lt;repository&gt;
341 </dt>
342 <dd>
344 The "remote" repository that is destination of a push
345 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).
348 </p>
349 </dd>
350 <dt>
351 &lt;refspec&gt;&#8230;
352 </dt>
353 <dd>
355 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.
360 </p>
361 <div class="para"><p>The &lt;src&gt; is often the name of the branch you would want to push, but
362 it 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
365 push. Arbitrary expressions cannot be used here, an actual ref must
366 be named. If <tt>:</tt>&lt;dst&gt; is omitted, the same ref as &lt;src&gt; will be
367 updated.</p></div>
368 <div class="para"><p>The object referenced by &lt;src&gt; is used to update the &lt;dst&gt; reference
369 on the remote side, but by default this is only allowed if the
370 update can fast-forward &lt;dst&gt;. By having the optional leading <tt>&#43;</tt>,
371 you can tell git to update the &lt;dst&gt; ref even when the update is not a
372 fast-forward. This does <strong>not</strong> attempt to merge &lt;src&gt; into &lt;dst&gt;. See
373 EXAMPLES below for details.</p></div>
374 <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>
375 <div class="para"><p>Pushing an empty &lt;src&gt; allows you to delete the &lt;dst&gt; ref from
376 the remote repository.</p></div>
377 <div class="para"><p>The special refspec <tt>:</tt> (or <tt>&#43;:</tt> to allow non-fast-forward updates)
378 directs git to push "matching" branches: for every branch that exists on
379 the local side, the remote side is updated if a branch of the same name
380 already exists on the remote side. This is the default operation mode
381 if no explicit refspec is found (that is neither on the command line
382 nor in any Push line of the corresponding remotes file---see below).</p></div>
383 </dd>
384 <dt>
385 --all
386 </dt>
387 <dd>
389 Instead of naming each ref to push, specifies that all
390 refs under <tt>refs/heads/</tt> be pushed.
391 </p>
392 </dd>
393 <dt>
394 --mirror
395 </dt>
396 <dd>
398 Instead of naming each ref to push, specifies that all
399 refs under <tt>refs/</tt> (which includes but is not
400 limited to <tt>refs/heads/</tt>, <tt>refs/remotes/</tt>, and <tt>refs/tags/</tt>)
401 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
404 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.
407 </p>
408 </dd>
409 <dt>
411 </dt>
412 <dt>
413 --dry-run
414 </dt>
415 <dd>
417 Do everything except actually send the updates.
418 </p>
419 </dd>
420 <dt>
421 --porcelain
422 </dt>
423 <dd>
425 Produce machine-readable output. The output status line for each ref
426 will be tab-separated and sent to stdout instead of stderr. The full
427 symbolic names of the refs will be given.
428 </p>
429 </dd>
430 <dt>
431 --delete
432 </dt>
433 <dd>
435 All listed refs are deleted from the remote repository. This is
436 the same as prefixing all refs with a colon.
437 </p>
438 </dd>
439 <dt>
440 --tags
441 </dt>
442 <dd>
444 All refs under <tt>refs/tags</tt> are pushed, in
445 addition to refspecs explicitly listed on the command
446 line.
447 </p>
448 </dd>
449 <dt>
450 --receive-pack=&lt;git-receive-pack&gt;
451 </dt>
452 <dt>
453 --exec=&lt;git-receive-pack&gt;
454 </dt>
455 <dd>
457 Path to the <em>git-receive-pack</em> program on the remote
458 end. Sometimes useful when pushing to a remote
459 repository over ssh, and you do not have the program in
460 a directory on the default $PATH.
461 </p>
462 </dd>
463 <dt>
465 </dt>
466 <dt>
467 --force
468 </dt>
469 <dd>
471 Usually, the command refuses to update a remote ref that is
472 not an ancestor of the local ref used to overwrite it.
473 This flag disables the check. This can cause the
474 remote repository to lose commits; use it with care.
475 </p>
476 </dd>
477 <dt>
478 --repo=&lt;repository&gt;
479 </dt>
480 <dd>
482 This option is only relevant if no &lt;repository&gt; argument is
483 passed in the invocation. In this case, <em>git push</em> derives the
484 remote name from the current branch: If it tracks a remote
485 branch, then that remote repository is pushed to. Otherwise,
486 the name "origin" is used. For this latter case, this option
487 can be used to override the name "origin". In other words,
488 the difference between these two commands
489 </p>
490 <div class="listingblock">
491 <div class="content">
492 <pre><tt>git push public #1
493 git push --repo=public #2</tt></pre>
494 </div></div>
495 <div class="para"><p>is that #1 always pushes to "public" whereas #2 pushes to "public"
496 only if the current branch does not track a remote branch. This is
497 useful if you write an alias or script around <em>git push</em>.</p></div>
498 </dd>
499 <dt>
501 </dt>
502 <dt>
503 --set-upstream
504 </dt>
505 <dd>
507 For every branch that is up to date or successfully pushed, add
508 upstream (tracking) reference, used by argument-less
509 <a href="git-pull.html">git-pull(1)</a> and other commands. For more information,
510 see <em>branch.&lt;name&gt;.merge</em> in <a href="git-config.html">git-config(1)</a>.
511 </p>
512 </dd>
513 <dt>
514 --thin
515 </dt>
516 <dt>
517 --no-thin
518 </dt>
519 <dd>
521 These options are passed to <a href="git-send-pack.html">git-send-pack(1)</a>. A thin transfer
522 significantly reduces the amount of sent data when the sender and
523 receiver share many of the same objects in common. The default is
524 --thin.
525 </p>
526 </dd>
527 <dt>
529 </dt>
530 <dt>
531 --quiet
532 </dt>
533 <dd>
535 Suppress all output, including the listing of updated refs,
536 unless an error occurs. Progress is not reported to the standard
537 error stream.
538 </p>
539 </dd>
540 <dt>
542 </dt>
543 <dt>
544 --verbose
545 </dt>
546 <dd>
548 Run verbosely.
549 </p>
550 </dd>
551 <dt>
552 --progress
553 </dt>
554 <dd>
556 Progress status is reported on the standard error stream
557 by default when it is attached to a terminal, unless -q
558 is specified. This flag forces progress status even if the
559 standard error stream is not directed to a terminal.
560 </p>
561 </dd>
562 </dl></div>
563 </div>
564 <h2 id="_git_urls_a_id_urls_a">GIT URLS<a id="URLS"></a></h2>
565 <div class="sectionbody">
566 <div class="para"><p>In general, URLs contain information about the transport protocol, the
567 address of the remote server, and the path to the repository.
568 Depending on the transport protocol, some of this information may be
569 absent.</p></div>
570 <div class="para"><p>Git natively supports ssh, git, http, https, ftp, ftps, and rsync
571 protocols. The following syntaxes may be used with them:</p></div>
572 <div class="ilist"><ul>
573 <li>
575 ssh://&#91;user@&#93;host.xz&#91;:port&#93;/path/to/repo.git/
576 </p>
577 </li>
578 <li>
580 git://host.xz&#91;:port&#93;/path/to/repo.git/
581 </p>
582 </li>
583 <li>
585 http&#91;s&#93;://host.xz&#91;:port&#93;/path/to/repo.git/
586 </p>
587 </li>
588 <li>
590 ftp&#91;s&#93;://host.xz&#91;:port&#93;/path/to/repo.git/
591 </p>
592 </li>
593 <li>
595 rsync://host.xz/path/to/repo.git/
596 </p>
597 </li>
598 </ul></div>
599 <div class="para"><p>An alternative scp-like syntax may also be used with the ssh protocol:</p></div>
600 <div class="ilist"><ul>
601 <li>
603 &#91;user@&#93;host.xz:path/to/repo.git/
604 </p>
605 </li>
606 </ul></div>
607 <div class="para"><p>The ssh and git protocols additionally support ~username expansion:</p></div>
608 <div class="ilist"><ul>
609 <li>
611 ssh://&#91;user@&#93;host.xz&#91;:port&#93;/~&#91;user&#93;/path/to/repo.git/
612 </p>
613 </li>
614 <li>
616 git://host.xz&#91;:port&#93;/~&#91;user&#93;/path/to/repo.git/
617 </p>
618 </li>
619 <li>
621 &#91;user@&#93;host.xz:/~&#91;user&#93;/path/to/repo.git/
622 </p>
623 </li>
624 </ul></div>
625 <div class="para"><p>For local respositories, also supported by git natively, the following
626 syntaxes may be used:</p></div>
627 <div class="ilist"><ul>
628 <li>
630 /path/to/repo.git/
631 </p>
632 </li>
633 <li>
635 file:///path/to/repo.git/
636 </p>
637 </li>
638 </ul></div>
639 <div class="para"><p>These two syntaxes are mostly equivalent, except when cloning, when
640 the former implies --local option. See <a href="git-clone.html">git-clone(1)</a> for
641 details.</p></div>
642 <div class="para"><p>When git doesn't know how to handle a certain transport protocol, it
643 attempts to use the <em>remote-&lt;transport&gt;</em> remote helper, if one
644 exists. To explicitly request a remote helper, the following syntax
645 may be used:</p></div>
646 <div class="ilist"><ul>
647 <li>
649 &lt;transport&gt;::&lt;address&gt;
650 </p>
651 </li>
652 </ul></div>
653 <div class="para"><p>where &lt;address&gt; may be a path, a server and path, or an arbitrary
654 URL-like string recognized by the specific remote helper being
655 invoked. See <a href="git-remote-helpers.html">git-remote-helpers(1)</a> for details.</p></div>
656 <div class="para"><p>If there are a large number of similarly-named remote repositories and
657 you want to use a different format for them (such that the URLs you
658 use will be rewritten into URLs that work), you can create a
659 configuration section of the form:</p></div>
660 <div class="listingblock">
661 <div class="content">
662 <pre><tt> [url "&lt;actual url base&gt;"]
663 insteadOf = &lt;other url base&gt;</tt></pre>
664 </div></div>
665 <div class="para"><p>For example, with this:</p></div>
666 <div class="listingblock">
667 <div class="content">
668 <pre><tt> [url "git://git.host.xz/"]
669 insteadOf = host.xz:/path/to/
670 insteadOf = work:</tt></pre>
671 </div></div>
672 <div class="para"><p>a URL like "work:repo.git" or like "host.xz:/path/to/repo.git" will be
673 rewritten in any context that takes a URL to be "git://git.host.xz/repo.git".</p></div>
674 <div class="para"><p>If you want to rewrite URLs for push only, you can create a
675 configuration section of the form:</p></div>
676 <div class="listingblock">
677 <div class="content">
678 <pre><tt> [url "&lt;actual url base&gt;"]
679 pushInsteadOf = &lt;other url base&gt;</tt></pre>
680 </div></div>
681 <div class="para"><p>For example, with this:</p></div>
682 <div class="listingblock">
683 <div class="content">
684 <pre><tt> [url "ssh://example.org/"]
685 pushInsteadOf = git://example.org/</tt></pre>
686 </div></div>
687 <div class="para"><p>a URL like "git://example.org/path/to/repo.git" will be rewritten to
688 "ssh://example.org/path/to/repo.git" for pushes, but pulls will still
689 use the original URL.</p></div>
690 </div>
691 <h2 id="_remotes_a_id_remotes_a">REMOTES<a id="REMOTES"></a></h2>
692 <div class="sectionbody">
693 <div class="para"><p>The name of one of the following can be used instead
694 of a URL as <tt>&lt;repository&gt;</tt> argument:</p></div>
695 <div class="ilist"><ul>
696 <li>
698 a remote in the git configuration file: <tt>$GIT_DIR/config</tt>,
699 </p>
700 </li>
701 <li>
703 a file in the <tt>$GIT_DIR/remotes</tt> directory, or
704 </p>
705 </li>
706 <li>
708 a file in the <tt>$GIT_DIR/branches</tt> directory.
709 </p>
710 </li>
711 </ul></div>
712 <div class="para"><p>All of these also allow you to omit the refspec from the command line
713 because they each contain a refspec which git will use by default.</p></div>
714 <h3 id="_named_remote_in_configuration_file">Named remote in configuration file</h3><div style="clear:left"></div>
715 <div class="para"><p>You can choose to provide the name of a remote which you had previously
716 configured using <a href="git-remote.html">git-remote(1)</a>, <a href="git-config.html">git-config(1)</a>
717 or even by a manual edit to the <tt>$GIT_DIR/config</tt> file. The URL of
718 this remote will be used to access the repository. The refspec
719 of this remote will be used by default when you do
720 not provide a refspec on the command line. The entry in the
721 config file would appear like this:</p></div>
722 <div class="listingblock">
723 <div class="content">
724 <pre><tt> [remote "&lt;name&gt;"]
725 url = &lt;url&gt;
726 pushurl = &lt;pushurl&gt;
727 push = &lt;refspec&gt;
728 fetch = &lt;refspec&gt;</tt></pre>
729 </div></div>
730 <div class="para"><p>The <tt>&lt;pushurl&gt;</tt> is used for pushes only. It is optional and defaults
731 to <tt>&lt;url&gt;</tt>.</p></div>
732 <h3 id="_named_file_in_tt_git_dir_remotes_tt">Named file in <tt>$GIT_DIR/remotes</tt></h3><div style="clear:left"></div>
733 <div class="para"><p>You can choose to provide the name of a
734 file in <tt>$GIT_DIR/remotes</tt>. The URL
735 in this file will be used to access the repository. The refspec
736 in this file will be used as default when you do not
737 provide a refspec on the command line. This file should have the
738 following format:</p></div>
739 <div class="listingblock">
740 <div class="content">
741 <pre><tt> URL: one of the above URL format
742 Push: &lt;refspec&gt;
743 Pull: &lt;refspec&gt;
744 </tt></pre>
745 </div></div>
746 <div class="para"><p><tt>Push:</tt> lines are used by <em>git push</em> and
747 <tt>Pull:</tt> lines are used by <em>git pull</em> and <em>git fetch</em>.
748 Multiple <tt>Push:</tt> and <tt>Pull:</tt> lines may
749 be specified for additional branch mappings.</p></div>
750 <h3 id="_named_file_in_tt_git_dir_branches_tt">Named file in <tt>$GIT_DIR/branches</tt></h3><div style="clear:left"></div>
751 <div class="para"><p>You can choose to provide the name of a
752 file in <tt>$GIT_DIR/branches</tt>.
753 The URL in this file will be used to access the repository.
754 This file should have the following format:</p></div>
755 <div class="listingblock">
756 <div class="content">
757 <pre><tt> &lt;url&gt;#&lt;head&gt;</tt></pre>
758 </div></div>
759 <div class="para"><p><tt>&lt;url&gt;</tt> is required; <tt>#&lt;head&gt;</tt> is optional.</p></div>
760 <div class="para"><p>Depending on the operation, git will use one of the following
761 refspecs, if you don't provide one on the command line.
762 <tt>&lt;branch&gt;</tt> is the name of this file in <tt>$GIT_DIR/branches</tt> and
763 <tt>&lt;head&gt;</tt> defaults to <tt>master</tt>.</p></div>
764 <div class="para"><p>git fetch uses:</p></div>
765 <div class="listingblock">
766 <div class="content">
767 <pre><tt> refs/heads/&lt;head&gt;:refs/heads/&lt;branch&gt;</tt></pre>
768 </div></div>
769 <div class="para"><p>git push uses:</p></div>
770 <div class="listingblock">
771 <div class="content">
772 <pre><tt> HEAD:refs/heads/&lt;head&gt;</tt></pre>
773 </div></div>
774 </div>
775 <h2 id="_output">OUTPUT</h2>
776 <div class="sectionbody">
777 <div class="para"><p>The output of "git push" depends on the transport method used; this
778 section describes the output when pushing over the git protocol (either
779 locally or via ssh).</p></div>
780 <div class="para"><p>The status of the push is output in tabular form, with each line
781 representing the status of a single ref. Each line is of the form:</p></div>
782 <div class="listingblock">
783 <div class="content">
784 <pre><tt> &lt;flag&gt; &lt;summary&gt; &lt;from&gt; -&gt; &lt;to&gt; (&lt;reason&gt;)</tt></pre>
785 </div></div>
786 <div class="para"><p>If --porcelain is used, then each line of the output is of the form:</p></div>
787 <div class="listingblock">
788 <div class="content">
789 <pre><tt> &lt;flag&gt; \t &lt;from&gt;:&lt;to&gt; \t &lt;summary&gt; (&lt;reason&gt;)</tt></pre>
790 </div></div>
791 <div class="para"><p>The status of up-to-date refs is shown only if --porcelain or --verbose
792 option is used.</p></div>
793 <div class="vlist"><dl>
794 <dt>
795 flag
796 </dt>
797 <dd>
799 A single character indicating the status of the ref:
800 </p>
801 <div class="hlist"><table>
802 <tr>
803 <td class="hlist1">
804 (space)
805 </td>
806 <td class="hlist2">
807 for a successfully pushed fast-forward;
808 </td>
809 </tr>
810 <tr>
811 <td class="hlist1">
812 <tt>&#43;</tt>
813 </td>
814 <td class="hlist2">
815 for a successful forced update;
816 </td>
817 </tr>
818 <tr>
819 <td class="hlist1">
820 <tt>-</tt>
821 </td>
822 <td class="hlist2">
823 for a successfully deleted ref;
824 </td>
825 </tr>
826 <tr>
827 <td class="hlist1">
828 <tt>*</tt>
829 </td>
830 <td class="hlist2">
831 for a successfully pushed new ref;
832 </td>
833 </tr>
834 <tr>
835 <td class="hlist1">
836 <tt>!</tt>
837 </td>
838 <td class="hlist2">
839 for a ref that was rejected or failed to push; and
840 </td>
841 </tr>
842 <tr>
843 <td class="hlist1">
844 <tt>=</tt>
845 </td>
846 <td class="hlist2">
847 for a ref that was up to date and did not need pushing.
848 </td>
849 </tr>
850 </table></div>
851 </dd>
852 <dt>
853 summary
854 </dt>
855 <dd>
857 For a successfully pushed ref, the summary shows the old and new
858 values of the ref in a form suitable for using as an argument to
859 <tt>git log</tt> (this is <tt>&lt;old&gt;..&lt;new&gt;</tt> in most cases, and
860 <tt>&lt;old&gt;&#8230;&lt;new&gt;</tt> for forced non-fast-forward updates). For a
861 failed update, more details are given for the failure.
862 The string <tt>rejected</tt> indicates that git did not try to send the
863 ref at all (typically because it is not a fast-forward). The
864 string <tt>remote rejected</tt> indicates that the remote end refused
865 the update; this rejection is typically caused by a hook on the
866 remote side. The string <tt>remote failure</tt> indicates that the
867 remote end did not report the successful update of the ref
868 (perhaps because of a temporary error on the remote side, a
869 break in the network connection, or other transient error).
870 </p>
871 </dd>
872 <dt>
873 from
874 </dt>
875 <dd>
877 The name of the local ref being pushed, minus its
878 <tt>refs/&lt;type&gt;/</tt> prefix. In the case of deletion, the
879 name of the local ref is omitted.
880 </p>
881 </dd>
882 <dt>
884 </dt>
885 <dd>
887 The name of the remote ref being updated, minus its
888 <tt>refs/&lt;type&gt;/</tt> prefix.
889 </p>
890 </dd>
891 <dt>
892 reason
893 </dt>
894 <dd>
896 A human-readable explanation. In the case of successfully pushed
897 refs, no explanation is needed. For a failed ref, the reason for
898 failure is described.
899 </p>
900 </dd>
901 </dl></div>
902 </div>
903 <h2 id="_note_about_fast_forwards">Note about fast-forwards</h2>
904 <div class="sectionbody">
905 <div class="para"><p>When an update changes a branch (or more in general, a ref) that used to
906 point at commit A to point at another commit B, it is called a
907 fast-forward update if and only if B is a descendant of A.</p></div>
908 <div class="para"><p>In a fast-forward update from A to B, the set of commits that the original
909 commit A built on top of is a subset of the commits the new commit B
910 builds on top of. Hence, it does not lose any history.</p></div>
911 <div class="para"><p>In contrast, a non-fast-forward update will lose history. For example,
912 suppose you and somebody else started at the same commit X, and you built
913 a history leading to commit B while the other person built a history
914 leading to commit A. The history looks like this:</p></div>
915 <div class="listingblock">
916 <div class="content">
917 <pre><tt>
920 ---X---A
921 </tt></pre>
922 </div></div>
923 <div class="para"><p>Further suppose that the other person already pushed changes leading to A
924 back to the original repository you two obtained the original commit X.</p></div>
925 <div class="para"><p>The push done by the other person updated the branch that used to point at
926 commit X to point at commit A. It is a fast-forward.</p></div>
927 <div class="para"><p>But if you try to push, you will attempt to update the branch (that
928 now points at A) with commit B. This does _not_ fast-forward. If you did
929 so, the changes introduced by commit A will be lost, because everybody
930 will now start building on top of B.</p></div>
931 <div class="para"><p>The command by default does not allow an update that is not a fast-forward
932 to prevent such loss of history.</p></div>
933 <div class="para"><p>If you do not want to lose your work (history from X to B) nor the work by
934 the other person (history from X to A), you would need to first fetch the
935 history from the repository, create a history that contains changes done
936 by both parties, and push the result back.</p></div>
937 <div class="para"><p>You can perform "git pull", resolve potential conflicts, and "git push"
938 the result. A "git pull" will create a merge commit C between commits A
939 and B.</p></div>
940 <div class="listingblock">
941 <div class="content">
942 <pre><tt>
943 B---C
945 ---X---A
946 </tt></pre>
947 </div></div>
948 <div class="para"><p>Updating A with the resulting merge commit will fast-forward and your
949 push will be accepted.</p></div>
950 <div class="para"><p>Alternatively, you can rebase your change between X and B on top of A,
951 with "git pull --rebase", and push the result back. The rebase will
952 create a new commit D that builds the change between X and B on top of
953 A.</p></div>
954 <div class="listingblock">
955 <div class="content">
956 <pre><tt>
959 ---X---A
960 </tt></pre>
961 </div></div>
962 <div class="para"><p>Again, updating A with this commit will fast-forward and your push will be
963 accepted.</p></div>
964 <div class="para"><p>There is another common situation where you may encounter non-fast-forward
965 rejection when you try to push, and it is possible even when you are
966 pushing into a repository nobody else pushes into. After you push commit
967 A yourself (in the first picture in this section), replace it with "git
968 commit --amend" to produce commit B, and you try to push it out, because
969 forgot that you have pushed A out already. In such a case, and only if
970 you are certain that nobody in the meantime fetched your earlier commit A
971 (and started building on top of it), you can run "git push --force" to
972 overwrite it. In other words, "git push --force" is a method reserved for
973 a case where you do mean to lose history.</p></div>
974 </div>
975 <h2 id="_examples">Examples</h2>
976 <div class="sectionbody">
977 <div class="vlist"><dl>
978 <dt>
979 git push
980 </dt>
981 <dd>
983 Works like <tt>git push &lt;remote&gt;</tt>, where &lt;remote&gt; is the
984 current branch's remote (or <tt>origin</tt>, if no remote is
985 configured for the current branch).
986 </p>
987 </dd>
988 <dt>
989 git push origin
990 </dt>
991 <dd>
993 Without additional configuration, works like
994 <tt>git push origin :</tt>.
995 </p>
996 <div class="para"><p>The default behavior of this command when no &lt;refspec&gt; is given can be
997 configured by setting the <tt>push</tt> option of the remote.</p></div>
998 <div class="para"><p>For example, to default to pushing only the current branch to <tt>origin</tt>
999 use <tt>git config remote.origin.push HEAD</tt>. Any valid &lt;refspec&gt; (like
1000 the ones in the examples below) can be configured as the default for
1001 <tt>git push origin</tt>.</p></div>
1002 </dd>
1003 <dt>
1004 git push origin :
1005 </dt>
1006 <dd>
1008 Push "matching" branches to <tt>origin</tt>. See
1009 &lt;refspec&gt; in the <a href="#OPTIONS">OPTIONS</a> section above for a
1010 description of "matching" branches.
1011 </p>
1012 </dd>
1013 <dt>
1014 git push origin master
1015 </dt>
1016 <dd>
1018 Find a ref that matches <tt>master</tt> in the source repository
1019 (most likely, it would find <tt>refs/heads/master</tt>), and update
1020 the same ref (e.g. <tt>refs/heads/master</tt>) in <tt>origin</tt> repository
1021 with it. If <tt>master</tt> did not exist remotely, it would be
1022 created.
1023 </p>
1024 </dd>
1025 <dt>
1026 git push origin HEAD
1027 </dt>
1028 <dd>
1030 A handy way to push the current branch to the same name on the
1031 remote.
1032 </p>
1033 </dd>
1034 <dt>
1035 git push origin master:satellite/master dev:satellite/dev
1036 </dt>
1037 <dd>
1039 Use the source ref that matches <tt>master</tt> (e.g. <tt>refs/heads/master</tt>)
1040 to update the ref that matches <tt>satellite/master</tt> (most probably
1041 <tt>refs/remotes/satellite/master</tt>) in the <tt>origin</tt> repository, then
1042 do the same for <tt>dev</tt> and <tt>satellite/dev</tt>.
1043 </p>
1044 </dd>
1045 <dt>
1046 git push origin HEAD:master
1047 </dt>
1048 <dd>
1050 Push the current branch to the remote ref matching <tt>master</tt> in the
1051 <tt>origin</tt> repository. This form is convenient to push the current
1052 branch without thinking about its local name.
1053 </p>
1054 </dd>
1055 <dt>
1056 git push origin master:refs/heads/experimental
1057 </dt>
1058 <dd>
1060 Create the branch <tt>experimental</tt> in the <tt>origin</tt> repository
1061 by copying the current <tt>master</tt> branch. This form is only
1062 needed to create a new branch or tag in the remote repository when
1063 the local name and the remote name are different; otherwise,
1064 the ref name on its own will work.
1065 </p>
1066 </dd>
1067 <dt>
1068 git push origin :experimental
1069 </dt>
1070 <dd>
1072 Find a ref that matches <tt>experimental</tt> in the <tt>origin</tt> repository
1073 (e.g. <tt>refs/heads/experimental</tt>), and delete it.
1074 </p>
1075 </dd>
1076 <dt>
1077 git push origin &#43;dev:master
1078 </dt>
1079 <dd>
1081 Update the origin repository's master branch with the dev branch,
1082 allowing non-fast-forward updates. <strong>This can leave unreferenced
1083 commits dangling in the origin repository.</strong> Consider the
1084 following situation, where a fast-forward is not possible:
1085 </p>
1086 <div class="listingblock">
1087 <div class="content">
1088 <pre><tt> o---o---o---A---B origin/master
1090 X---Y---Z dev</tt></pre>
1091 </div></div>
1092 <div class="para"><p>The above command would change the origin repository to</p></div>
1093 <div class="listingblock">
1094 <div class="content">
1095 <pre><tt> A---B (unnamed branch)
1097 o---o---o---X---Y---Z master</tt></pre>
1098 </div></div>
1099 <div class="para"><p>Commits A and B would no longer belong to a branch with a symbolic name,
1100 and so would be unreachable. As such, these commits would be removed by
1101 a <tt>git gc</tt> command on the origin repository.</p></div>
1102 </dd>
1103 </dl></div>
1104 </div>
1105 <h2 id="_author">Author</h2>
1106 <div class="sectionbody">
1107 <div class="para"><p>Written by Junio C Hamano &lt;gitster@pobox.com&gt;, later rewritten in C
1108 by Linus Torvalds &lt;torvalds@osdl.org&gt;</p></div>
1109 </div>
1110 <h2 id="_documentation">Documentation</h2>
1111 <div class="sectionbody">
1112 <div class="para"><p>Documentation by Junio C Hamano and the git-list &lt;git@vger.kernel.org&gt;.</p></div>
1113 </div>
1114 <h2 id="_git">GIT</h2>
1115 <div class="sectionbody">
1116 <div class="para"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
1117 </div>
1118 <div id="footer">
1119 <div id="footer-text">
1120 Last updated 2010-04-24 02:56:03 UTC
1121 </div>
1122 </div>
1123 </body>
1124 </html>