Autogenerated HTML docs for v1.7.5-52-ge839f
[git/jnareb-git.git] / git-push.html
blob2db82d04549fef958ede10151710e1f2eed0d22e
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.4.5" />
7 <title>git-push(1)</title>
8 <style type="text/css">
9 /* Debug borders */
10 p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
12 border: 1px solid red;
16 body {
17 margin: 1em 5% 1em 5%;
20 a {
21 color: blue;
22 text-decoration: underline;
24 a:visited {
25 color: fuchsia;
28 em {
29 font-style: italic;
30 color: navy;
33 strong {
34 font-weight: bold;
35 color: #083194;
38 tt {
39 color: navy;
42 h1, h2, h3, h4, h5, h6 {
43 color: #527bbd;
44 font-family: sans-serif;
45 margin-top: 1.2em;
46 margin-bottom: 0.5em;
47 line-height: 1.3;
50 h1, h2, h3 {
51 border-bottom: 2px solid silver;
53 h2 {
54 padding-top: 0.5em;
56 h3 {
57 float: left;
59 h3 + * {
60 clear: left;
63 div.sectionbody {
64 font-family: serif;
65 margin-left: 0;
68 hr {
69 border: 1px solid silver;
72 p {
73 margin-top: 0.5em;
74 margin-bottom: 0.5em;
77 ul, ol, li > p {
78 margin-top: 0;
81 pre {
82 padding: 0;
83 margin: 0;
86 span#author {
87 color: #527bbd;
88 font-family: sans-serif;
89 font-weight: bold;
90 font-size: 1.1em;
92 span#email {
94 span#revnumber, span#revdate, span#revremark {
95 font-family: sans-serif;
98 div#footer {
99 font-family: sans-serif;
100 font-size: small;
101 border-top: 2px solid silver;
102 padding-top: 0.5em;
103 margin-top: 4.0em;
105 div#footer-text {
106 float: left;
107 padding-bottom: 0.5em;
109 div#footer-badges {
110 float: right;
111 padding-bottom: 0.5em;
114 div#preamble {
115 margin-top: 1.5em;
116 margin-bottom: 1.5em;
118 div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
119 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
120 div.admonitionblock {
121 margin-top: 1.5em;
122 margin-bottom: 1.5em;
124 div.admonitionblock {
125 margin-top: 2.5em;
126 margin-bottom: 2.5em;
129 div.content { /* Block element content. */
130 padding: 0;
133 /* Block element titles. */
134 div.title, caption.title {
135 color: #527bbd;
136 font-family: sans-serif;
137 font-weight: bold;
138 text-align: left;
139 margin-top: 1.0em;
140 margin-bottom: 0.5em;
142 div.title + * {
143 margin-top: 0;
146 td div.title:first-child {
147 margin-top: 0.0em;
149 div.content div.title:first-child {
150 margin-top: 0.0em;
152 div.content + div.title {
153 margin-top: 0.0em;
156 div.sidebarblock > div.content {
157 background: #ffffee;
158 border: 1px solid silver;
159 padding: 0.5em;
162 div.listingblock > div.content {
163 border: 1px solid silver;
164 background: #f4f4f4;
165 padding: 0.5em;
168 div.quoteblock {
169 padding-left: 2.0em;
170 margin-right: 10%;
172 div.quoteblock > div.attribution {
173 padding-top: 0.5em;
174 text-align: right;
177 div.verseblock {
178 padding-left: 2.0em;
179 margin-right: 10%;
181 div.verseblock > div.content {
182 white-space: pre;
184 div.verseblock > div.attribution {
185 padding-top: 0.75em;
186 text-align: left;
188 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
189 div.verseblock + div.attribution {
190 text-align: left;
193 div.admonitionblock .icon {
194 vertical-align: top;
195 font-size: 1.1em;
196 font-weight: bold;
197 text-decoration: underline;
198 color: #527bbd;
199 padding-right: 0.5em;
201 div.admonitionblock td.content {
202 padding-left: 0.5em;
203 border-left: 2px solid silver;
206 div.exampleblock > div.content {
207 border-left: 2px solid silver;
208 padding: 0.5em;
211 div.imageblock div.content { padding-left: 0; }
212 span.image img { border-style: none; }
213 a.image:visited { color: white; }
215 dl {
216 margin-top: 0.8em;
217 margin-bottom: 0.8em;
219 dt {
220 margin-top: 0.5em;
221 margin-bottom: 0;
222 font-style: normal;
223 color: navy;
225 dd > *:first-child {
226 margin-top: 0.1em;
229 ul, ol {
230 list-style-position: outside;
232 ol.arabic {
233 list-style-type: decimal;
235 ol.loweralpha {
236 list-style-type: lower-alpha;
238 ol.upperalpha {
239 list-style-type: upper-alpha;
241 ol.lowerroman {
242 list-style-type: lower-roman;
244 ol.upperroman {
245 list-style-type: upper-roman;
248 div.compact ul, div.compact ol,
249 div.compact p, div.compact p,
250 div.compact div, div.compact div {
251 margin-top: 0.1em;
252 margin-bottom: 0.1em;
255 div.tableblock > table {
256 border: 3px solid #527bbd;
258 thead {
259 font-family: sans-serif;
260 font-weight: bold;
262 tfoot {
263 font-weight: bold;
265 td > div.verse {
266 white-space: pre;
268 p.table {
269 margin-top: 0;
271 /* Because the table frame attribute is overriden by CSS in most browsers. */
272 div.tableblock > table[frame="void"] {
273 border-style: none;
275 div.tableblock > table[frame="hsides"] {
276 border-left-style: none;
277 border-right-style: none;
279 div.tableblock > table[frame="vsides"] {
280 border-top-style: none;
281 border-bottom-style: none;
285 div.hdlist {
286 margin-top: 0.8em;
287 margin-bottom: 0.8em;
289 div.hdlist tr {
290 padding-bottom: 15px;
292 dt.hdlist1.strong, td.hdlist1.strong {
293 font-weight: bold;
295 td.hdlist1 {
296 vertical-align: top;
297 font-style: normal;
298 padding-right: 0.8em;
299 color: navy;
301 td.hdlist2 {
302 vertical-align: top;
304 div.hdlist.compact tr {
305 margin: 0;
306 padding-bottom: 0;
309 .comment {
310 background: yellow;
313 @media print {
314 div#footer-badges { display: none; }
317 div#toctitle {
318 color: #527bbd;
319 font-family: sans-serif;
320 font-size: 1.1em;
321 font-weight: bold;
322 margin-top: 1.0em;
323 margin-bottom: 0.1em;
326 div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
327 margin-top: 0;
328 margin-bottom: 0;
330 div.toclevel2 {
331 margin-left: 2em;
332 font-size: 0.9em;
334 div.toclevel3 {
335 margin-left: 4em;
336 font-size: 0.9em;
338 div.toclevel4 {
339 margin-left: 6em;
340 font-size: 0.9em;
342 /* Overrides for manpage documents */
343 h1 {
344 padding-top: 0.5em;
345 padding-bottom: 0.5em;
346 border-top: 2px solid silver;
347 border-bottom: 2px solid silver;
349 h2 {
350 border-style: none;
352 div.sectionbody {
353 margin-left: 5%;
356 @media print {
357 div#toc { display: none; }
360 /* Workarounds for IE6's broken and incomplete CSS2. */
362 div.sidebar-content {
363 background: #ffffee;
364 border: 1px solid silver;
365 padding: 0.5em;
367 div.sidebar-title, div.image-title {
368 color: #527bbd;
369 font-family: sans-serif;
370 font-weight: bold;
371 margin-top: 0.0em;
372 margin-bottom: 0.5em;
375 div.listingblock div.content {
376 border: 1px solid silver;
377 background: #f4f4f4;
378 padding: 0.5em;
381 div.quoteblock-attribution {
382 padding-top: 0.5em;
383 text-align: right;
386 div.verseblock-content {
387 white-space: pre;
389 div.verseblock-attribution {
390 padding-top: 0.75em;
391 text-align: left;
394 div.exampleblock-content {
395 border-left: 2px solid silver;
396 padding-left: 0.5em;
399 /* IE6 sets dynamically generated links as visited. */
400 div#toc a:visited { color: blue; }
401 </style>
402 </head>
403 <body>
404 <div id="header">
405 <h1>
406 git-push(1) Manual Page
407 </h1>
408 <h2>NAME</h2>
409 <div class="sectionbody">
410 <p>git-push -
411 Update remote refs along with associated objects
412 </p>
413 </div>
414 </div>
415 <h2 id="_synopsis">SYNOPSIS</h2>
416 <div class="sectionbody">
417 <div class="verseblock">
418 <div class="verseblock-content"><em>git push</em> [--all | --mirror | --tags] [-n | --dry-run] [--receive-pack=&lt;git-receive-pack&gt;]
419 [--repo=&lt;repository&gt;] [-f | --force] [-v | --verbose] [-u | --set-upstream]
420 [&lt;repository&gt; [&lt;refspec&gt;&#8230;]]</div>
421 <div class="verseblock-attribution">
422 </div></div>
423 </div>
424 <h2 id="_description">DESCRIPTION</h2>
425 <div class="sectionbody">
426 <div class="paragraph"><p>Updates remote refs using local refs, while sending objects
427 necessary to complete the given refs.</p></div>
428 <div class="paragraph"><p>You can make interesting things happen to a repository
429 every time you push into it, by setting up <em>hooks</em> there. See
430 documentation for <a href="git-receive-pack.html">git-receive-pack(1)</a>.</p></div>
431 </div>
432 <h2 id="_options_a_id_options_a">OPTIONS<a id="OPTIONS"></a></h2>
433 <div class="sectionbody">
434 <div class="dlist"><dl>
435 <dt class="hdlist1">
436 &lt;repository&gt;
437 </dt>
438 <dd>
440 The "remote" repository that is destination of a push
441 operation. This parameter can be either a URL
442 (see the section <a href="#URLS">GIT URLS</a> below) or the name
443 of a remote (see the section <a href="#REMOTES">REMOTES</a> below).
444 </p>
445 </dd>
446 <dt class="hdlist1">
447 &lt;refspec&gt;&#8230;
448 </dt>
449 <dd>
451 The format of a &lt;refspec&gt; parameter is an optional plus
452 <tt>&#43;</tt>, followed by the source ref &lt;src&gt;, followed
453 by a colon <tt>:</tt>, followed by the destination ref &lt;dst&gt;.
454 It is used to specify with what &lt;src&gt; object the &lt;dst&gt; ref
455 in the remote repository is to be updated.
456 </p>
457 <div class="paragraph"><p>The &lt;src&gt; is often the name of the branch you would want to push, but
458 it can be any arbitrary "SHA-1 expression", such as <tt>master~4</tt> or
459 <tt>HEAD</tt> (see <a href="gitrevisions.html">gitrevisions(7)</a>).</p></div>
460 <div class="paragraph"><p>The &lt;dst&gt; tells which ref on the remote side is updated with this
461 push. Arbitrary expressions cannot be used here, an actual ref must
462 be named. If <tt>:</tt>&lt;dst&gt; is omitted, the same ref as &lt;src&gt; will be
463 updated.</p></div>
464 <div class="paragraph"><p>The object referenced by &lt;src&gt; is used to update the &lt;dst&gt; reference
465 on the remote side, but by default this is only allowed if the
466 update can fast-forward &lt;dst&gt;. By having the optional leading <tt>&#43;</tt>,
467 you can tell git to update the &lt;dst&gt; ref even when the update is not a
468 fast-forward. This does <strong>not</strong> attempt to merge &lt;src&gt; into &lt;dst&gt;. See
469 EXAMPLES below for details.</p></div>
470 <div class="paragraph"><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>
471 <div class="paragraph"><p>Pushing an empty &lt;src&gt; allows you to delete the &lt;dst&gt; ref from
472 the remote repository.</p></div>
473 <div class="paragraph"><p>The special refspec <tt>:</tt> (or <tt>&#43;:</tt> to allow non-fast-forward updates)
474 directs git to push "matching" branches: for every branch that exists on
475 the local side, the remote side is updated if a branch of the same name
476 already exists on the remote side. This is the default operation mode
477 if no explicit refspec is found (that is neither on the command line
478 nor in any Push line of the corresponding remotes file---see below).</p></div>
479 </dd>
480 <dt class="hdlist1">
481 --all
482 </dt>
483 <dd>
485 Instead of naming each ref to push, specifies that all
486 refs under <tt>refs/heads/</tt> be pushed.
487 </p>
488 </dd>
489 <dt class="hdlist1">
490 --mirror
491 </dt>
492 <dd>
494 Instead of naming each ref to push, specifies that all
495 refs under <tt>refs/</tt> (which includes but is not
496 limited to <tt>refs/heads/</tt>, <tt>refs/remotes/</tt>, and <tt>refs/tags/</tt>)
497 be mirrored to the remote repository. Newly created local
498 refs will be pushed to the remote end, locally updated refs
499 will be force updated on the remote end, and deleted refs
500 will be removed from the remote end. This is the default
501 if the configuration option <tt>remote.&lt;remote&gt;.mirror</tt> is
502 set.
503 </p>
504 </dd>
505 <dt class="hdlist1">
507 </dt>
508 <dt class="hdlist1">
509 --dry-run
510 </dt>
511 <dd>
513 Do everything except actually send the updates.
514 </p>
515 </dd>
516 <dt class="hdlist1">
517 --porcelain
518 </dt>
519 <dd>
521 Produce machine-readable output. The output status line for each ref
522 will be tab-separated and sent to stdout instead of stderr. The full
523 symbolic names of the refs will be given.
524 </p>
525 </dd>
526 <dt class="hdlist1">
527 --delete
528 </dt>
529 <dd>
531 All listed refs are deleted from the remote repository. This is
532 the same as prefixing all refs with a colon.
533 </p>
534 </dd>
535 <dt class="hdlist1">
536 --tags
537 </dt>
538 <dd>
540 All refs under <tt>refs/tags</tt> are pushed, in
541 addition to refspecs explicitly listed on the command
542 line.
543 </p>
544 </dd>
545 <dt class="hdlist1">
546 --receive-pack=&lt;git-receive-pack&gt;
547 </dt>
548 <dt class="hdlist1">
549 --exec=&lt;git-receive-pack&gt;
550 </dt>
551 <dd>
553 Path to the <em>git-receive-pack</em> program on the remote
554 end. Sometimes useful when pushing to a remote
555 repository over ssh, and you do not have the program in
556 a directory on the default $PATH.
557 </p>
558 </dd>
559 <dt class="hdlist1">
561 </dt>
562 <dt class="hdlist1">
563 --force
564 </dt>
565 <dd>
567 Usually, the command refuses to update a remote ref that is
568 not an ancestor of the local ref used to overwrite it.
569 This flag disables the check. This can cause the
570 remote repository to lose commits; use it with care.
571 </p>
572 </dd>
573 <dt class="hdlist1">
574 --repo=&lt;repository&gt;
575 </dt>
576 <dd>
578 This option is only relevant if no &lt;repository&gt; argument is
579 passed in the invocation. In this case, <em>git push</em> derives the
580 remote name from the current branch: If it tracks a remote
581 branch, then that remote repository is pushed to. Otherwise,
582 the name "origin" is used. For this latter case, this option
583 can be used to override the name "origin". In other words,
584 the difference between these two commands
585 </p>
586 <div class="listingblock">
587 <div class="content">
588 <pre><tt>git push public #1
589 git push --repo=public #2</tt></pre>
590 </div></div>
591 <div class="paragraph"><p>is that #1 always pushes to "public" whereas #2 pushes to "public"
592 only if the current branch does not track a remote branch. This is
593 useful if you write an alias or script around <em>git push</em>.</p></div>
594 </dd>
595 <dt class="hdlist1">
597 </dt>
598 <dt class="hdlist1">
599 --set-upstream
600 </dt>
601 <dd>
603 For every branch that is up to date or successfully pushed, add
604 upstream (tracking) reference, used by argument-less
605 <a href="git-pull.html">git-pull(1)</a> and other commands. For more information,
606 see <em>branch.&lt;name&gt;.merge</em> in <a href="git-config.html">git-config(1)</a>.
607 </p>
608 </dd>
609 <dt class="hdlist1">
610 --thin
611 </dt>
612 <dt class="hdlist1">
613 --no-thin
614 </dt>
615 <dd>
617 These options are passed to <a href="git-send-pack.html">git-send-pack(1)</a>. A thin transfer
618 significantly reduces the amount of sent data when the sender and
619 receiver share many of the same objects in common. The default is
620 --thin.
621 </p>
622 </dd>
623 <dt class="hdlist1">
625 </dt>
626 <dt class="hdlist1">
627 --quiet
628 </dt>
629 <dd>
631 Suppress all output, including the listing of updated refs,
632 unless an error occurs. Progress is not reported to the standard
633 error stream.
634 </p>
635 </dd>
636 <dt class="hdlist1">
638 </dt>
639 <dt class="hdlist1">
640 --verbose
641 </dt>
642 <dd>
644 Run verbosely.
645 </p>
646 </dd>
647 <dt class="hdlist1">
648 --progress
649 </dt>
650 <dd>
652 Progress status is reported on the standard error stream
653 by default when it is attached to a terminal, unless -q
654 is specified. This flag forces progress status even if the
655 standard error stream is not directed to a terminal.
656 </p>
657 </dd>
658 </dl></div>
659 </div>
660 <h2 id="_git_urls_a_id_urls_a">GIT URLS<a id="URLS"></a></h2>
661 <div class="sectionbody">
662 <div class="paragraph"><p>In general, URLs contain information about the transport protocol, the
663 address of the remote server, and the path to the repository.
664 Depending on the transport protocol, some of this information may be
665 absent.</p></div>
666 <div class="paragraph"><p>Git natively supports ssh, git, http, https, ftp, ftps, and rsync
667 protocols. The following syntaxes may be used with them:</p></div>
668 <div class="ulist"><ul>
669 <li>
671 ssh://&#91;user@&#93;host.xz&#91;:port&#93;/path/to/repo.git/
672 </p>
673 </li>
674 <li>
676 git://host.xz&#91;:port&#93;/path/to/repo.git/
677 </p>
678 </li>
679 <li>
681 http&#91;s&#93;://host.xz&#91;:port&#93;/path/to/repo.git/
682 </p>
683 </li>
684 <li>
686 ftp&#91;s&#93;://host.xz&#91;:port&#93;/path/to/repo.git/
687 </p>
688 </li>
689 <li>
691 rsync://host.xz/path/to/repo.git/
692 </p>
693 </li>
694 </ul></div>
695 <div class="paragraph"><p>An alternative scp-like syntax may also be used with the ssh protocol:</p></div>
696 <div class="ulist"><ul>
697 <li>
699 &#91;user@&#93;host.xz:path/to/repo.git/
700 </p>
701 </li>
702 </ul></div>
703 <div class="paragraph"><p>The ssh and git protocols additionally support ~username expansion:</p></div>
704 <div class="ulist"><ul>
705 <li>
707 ssh://&#91;user@&#93;host.xz&#91;:port&#93;/~&#91;user&#93;/path/to/repo.git/
708 </p>
709 </li>
710 <li>
712 git://host.xz&#91;:port&#93;/~&#91;user&#93;/path/to/repo.git/
713 </p>
714 </li>
715 <li>
717 &#91;user@&#93;host.xz:/~&#91;user&#93;/path/to/repo.git/
718 </p>
719 </li>
720 </ul></div>
721 <div class="paragraph"><p>For local repositories, also supported by git natively, the following
722 syntaxes may be used:</p></div>
723 <div class="ulist"><ul>
724 <li>
726 /path/to/repo.git/
727 </p>
728 </li>
729 <li>
731 <a href="file:///path/to/repo.git/">file:///path/to/repo.git/</a>
732 </p>
733 </li>
734 </ul></div>
735 <div class="paragraph"><p>These two syntaxes are mostly equivalent, except when cloning, when
736 the former implies --local option. See <a href="git-clone.html">git-clone(1)</a> for
737 details.</p></div>
738 <div class="paragraph"><p>When git doesn&#8217;t know how to handle a certain transport protocol, it
739 attempts to use the <em>remote-&lt;transport&gt;</em> remote helper, if one
740 exists. To explicitly request a remote helper, the following syntax
741 may be used:</p></div>
742 <div class="ulist"><ul>
743 <li>
745 &lt;transport&gt;::&lt;address&gt;
746 </p>
747 </li>
748 </ul></div>
749 <div class="paragraph"><p>where &lt;address&gt; may be a path, a server and path, or an arbitrary
750 URL-like string recognized by the specific remote helper being
751 invoked. See <a href="git-remote-helpers.html">git-remote-helpers(1)</a> for details.</p></div>
752 <div class="paragraph"><p>If there are a large number of similarly-named remote repositories and
753 you want to use a different format for them (such that the URLs you
754 use will be rewritten into URLs that work), you can create a
755 configuration section of the form:</p></div>
756 <div class="listingblock">
757 <div class="content">
758 <pre><tt> [url "&lt;actual url base&gt;"]
759 insteadOf = &lt;other url base&gt;</tt></pre>
760 </div></div>
761 <div class="paragraph"><p>For example, with this:</p></div>
762 <div class="listingblock">
763 <div class="content">
764 <pre><tt> [url "git://git.host.xz/"]
765 insteadOf = host.xz:/path/to/
766 insteadOf = work:</tt></pre>
767 </div></div>
768 <div class="paragraph"><p>a URL like "work:repo.git" or like "host.xz:/path/to/repo.git" will be
769 rewritten in any context that takes a URL to be "git://git.host.xz/repo.git".</p></div>
770 <div class="paragraph"><p>If you want to rewrite URLs for push only, you can create a
771 configuration section of the form:</p></div>
772 <div class="listingblock">
773 <div class="content">
774 <pre><tt> [url "&lt;actual url base&gt;"]
775 pushInsteadOf = &lt;other url base&gt;</tt></pre>
776 </div></div>
777 <div class="paragraph"><p>For example, with this:</p></div>
778 <div class="listingblock">
779 <div class="content">
780 <pre><tt> [url "ssh://example.org/"]
781 pushInsteadOf = git://example.org/</tt></pre>
782 </div></div>
783 <div class="paragraph"><p>a URL like "git://example.org/path/to/repo.git" will be rewritten to
784 "ssh://example.org/path/to/repo.git" for pushes, but pulls will still
785 use the original URL.</p></div>
786 </div>
787 <h2 id="_remotes_a_id_remotes_a">REMOTES<a id="REMOTES"></a></h2>
788 <div class="sectionbody">
789 <div class="paragraph"><p>The name of one of the following can be used instead
790 of a URL as <tt>&lt;repository&gt;</tt> argument:</p></div>
791 <div class="ulist"><ul>
792 <li>
794 a remote in the git configuration file: <tt>$GIT_DIR/config</tt>,
795 </p>
796 </li>
797 <li>
799 a file in the <tt>$GIT_DIR/remotes</tt> directory, or
800 </p>
801 </li>
802 <li>
804 a file in the <tt>$GIT_DIR/branches</tt> directory.
805 </p>
806 </li>
807 </ul></div>
808 <div class="paragraph"><p>All of these also allow you to omit the refspec from the command line
809 because they each contain a refspec which git will use by default.</p></div>
810 <h3 id="_named_remote_in_configuration_file">Named remote in configuration file</h3><div style="clear:left"></div>
811 <div class="paragraph"><p>You can choose to provide the name of a remote which you had previously
812 configured using <a href="git-remote.html">git-remote(1)</a>, <a href="git-config.html">git-config(1)</a>
813 or even by a manual edit to the <tt>$GIT_DIR/config</tt> file. The URL of
814 this remote will be used to access the repository. The refspec
815 of this remote will be used by default when you do
816 not provide a refspec on the command line. The entry in the
817 config file would appear like this:</p></div>
818 <div class="listingblock">
819 <div class="content">
820 <pre><tt> [remote "&lt;name&gt;"]
821 url = &lt;url&gt;
822 pushurl = &lt;pushurl&gt;
823 push = &lt;refspec&gt;
824 fetch = &lt;refspec&gt;</tt></pre>
825 </div></div>
826 <div class="paragraph"><p>The <tt>&lt;pushurl&gt;</tt> is used for pushes only. It is optional and defaults
827 to <tt>&lt;url&gt;</tt>.</p></div>
828 <h3 id="_named_file_in_tt_git_dir_remotes_tt">Named file in <tt>$GIT_DIR/remotes</tt></h3><div style="clear:left"></div>
829 <div class="paragraph"><p>You can choose to provide the name of a
830 file in <tt>$GIT_DIR/remotes</tt>. The URL
831 in this file will be used to access the repository. The refspec
832 in this file will be used as default when you do not
833 provide a refspec on the command line. This file should have the
834 following format:</p></div>
835 <div class="listingblock">
836 <div class="content">
837 <pre><tt> URL: one of the above URL format
838 Push: &lt;refspec&gt;
839 Pull: &lt;refspec&gt;</tt></pre>
840 </div></div>
841 <div class="paragraph"><p><tt>Push:</tt> lines are used by <em>git push</em> and
842 <tt>Pull:</tt> lines are used by <em>git pull</em> and <em>git fetch</em>.
843 Multiple <tt>Push:</tt> and <tt>Pull:</tt> lines may
844 be specified for additional branch mappings.</p></div>
845 <h3 id="_named_file_in_tt_git_dir_branches_tt">Named file in <tt>$GIT_DIR/branches</tt></h3><div style="clear:left"></div>
846 <div class="paragraph"><p>You can choose to provide the name of a
847 file in <tt>$GIT_DIR/branches</tt>.
848 The URL in this file will be used to access the repository.
849 This file should have the following format:</p></div>
850 <div class="listingblock">
851 <div class="content">
852 <pre><tt> &lt;url&gt;#&lt;head&gt;</tt></pre>
853 </div></div>
854 <div class="paragraph"><p><tt>&lt;url&gt;</tt> is required; <tt>#&lt;head&gt;</tt> is optional.</p></div>
855 <div class="paragraph"><p>Depending on the operation, git will use one of the following
856 refspecs, if you don&#8217;t provide one on the command line.
857 <tt>&lt;branch&gt;</tt> is the name of this file in <tt>$GIT_DIR/branches</tt> and
858 <tt>&lt;head&gt;</tt> defaults to <tt>master</tt>.</p></div>
859 <div class="paragraph"><p>git fetch uses:</p></div>
860 <div class="listingblock">
861 <div class="content">
862 <pre><tt> refs/heads/&lt;head&gt;:refs/heads/&lt;branch&gt;</tt></pre>
863 </div></div>
864 <div class="paragraph"><p>git push uses:</p></div>
865 <div class="listingblock">
866 <div class="content">
867 <pre><tt> HEAD:refs/heads/&lt;head&gt;</tt></pre>
868 </div></div>
869 </div>
870 <h2 id="_output">OUTPUT</h2>
871 <div class="sectionbody">
872 <div class="paragraph"><p>The output of "git push" depends on the transport method used; this
873 section describes the output when pushing over the git protocol (either
874 locally or via ssh).</p></div>
875 <div class="paragraph"><p>The status of the push is output in tabular form, with each line
876 representing the status of a single ref. Each line is of the form:</p></div>
877 <div class="listingblock">
878 <div class="content">
879 <pre><tt> &lt;flag&gt; &lt;summary&gt; &lt;from&gt; -&gt; &lt;to&gt; (&lt;reason&gt;)</tt></pre>
880 </div></div>
881 <div class="paragraph"><p>If --porcelain is used, then each line of the output is of the form:</p></div>
882 <div class="listingblock">
883 <div class="content">
884 <pre><tt> &lt;flag&gt; \t &lt;from&gt;:&lt;to&gt; \t &lt;summary&gt; (&lt;reason&gt;)</tt></pre>
885 </div></div>
886 <div class="paragraph"><p>The status of up-to-date refs is shown only if --porcelain or --verbose
887 option is used.</p></div>
888 <div class="dlist"><dl>
889 <dt class="hdlist1">
890 flag
891 </dt>
892 <dd>
894 A single character indicating the status of the ref:
895 </p>
896 <div class="dlist"><dl>
897 <dt class="hdlist1">
898 (space)
899 </dt>
900 <dd>
902 for a successfully pushed fast-forward;
903 </p>
904 </dd>
905 <dt class="hdlist1">
906 <tt>&#43;</tt>
907 </dt>
908 <dd>
910 for a successful forced update;
911 </p>
912 </dd>
913 <dt class="hdlist1">
914 <tt>-</tt>
915 </dt>
916 <dd>
918 for a successfully deleted ref;
919 </p>
920 </dd>
921 <dt class="hdlist1">
922 <tt>*</tt>
923 </dt>
924 <dd>
926 for a successfully pushed new ref;
927 </p>
928 </dd>
929 <dt class="hdlist1">
930 <tt>!</tt>
931 </dt>
932 <dd>
934 for a ref that was rejected or failed to push; and
935 </p>
936 </dd>
937 <dt class="hdlist1">
938 <tt>=</tt>
939 </dt>
940 <dd>
942 for a ref that was up to date and did not need pushing.
943 </p>
944 </dd>
945 </dl></div>
946 </dd>
947 <dt class="hdlist1">
948 summary
949 </dt>
950 <dd>
952 For a successfully pushed ref, the summary shows the old and new
953 values of the ref in a form suitable for using as an argument to
954 <tt>git log</tt> (this is <tt>&lt;old&gt;..&lt;new&gt;</tt> in most cases, and
955 <tt>&lt;old&gt;...&lt;new&gt;</tt> for forced non-fast-forward updates).
956 </p>
957 <div class="paragraph"><p>For a failed update, more details are given:</p></div>
958 <div class="dlist"><dl>
959 <dt class="hdlist1">
960 rejected
961 </dt>
962 <dd>
964 Git did not try to send the ref at all, typically because it
965 is not a fast-forward and you did not force the update.
966 </p>
967 </dd>
968 <dt class="hdlist1">
969 remote rejected
970 </dt>
971 <dd>
973 The remote end refused the update. Usually caused by a hook
974 on the remote side, or because the remote repository has one
975 of the following safety options in effect:
976 <tt>receive.denyCurrentBranch</tt> (for pushes to the checked out
977 branch), <tt>receive.denyNonFastForwards</tt> (for forced
978 non-fast-forward updates), <tt>receive.denyDeletes</tt> or
979 <tt>receive.denyDeleteCurrent</tt>. See <a href="git-config.html">git-config(1)</a>.
980 </p>
981 </dd>
982 <dt class="hdlist1">
983 remote failure
984 </dt>
985 <dd>
987 The remote end did not report the successful update of the ref,
988 perhaps because of a temporary error on the remote side, a
989 break in the network connection, or other transient error.
990 </p>
991 </dd>
992 </dl></div>
993 </dd>
994 <dt class="hdlist1">
995 from
996 </dt>
997 <dd>
999 The name of the local ref being pushed, minus its
1000 <tt>refs/&lt;type&gt;/</tt> prefix. In the case of deletion, the
1001 name of the local ref is omitted.
1002 </p>
1003 </dd>
1004 <dt class="hdlist1">
1006 </dt>
1007 <dd>
1009 The name of the remote ref being updated, minus its
1010 <tt>refs/&lt;type&gt;/</tt> prefix.
1011 </p>
1012 </dd>
1013 <dt class="hdlist1">
1014 reason
1015 </dt>
1016 <dd>
1018 A human-readable explanation. In the case of successfully pushed
1019 refs, no explanation is needed. For a failed ref, the reason for
1020 failure is described.
1021 </p>
1022 </dd>
1023 </dl></div>
1024 </div>
1025 <h2 id="_note_about_fast_forwards">Note about fast-forwards</h2>
1026 <div class="sectionbody">
1027 <div class="paragraph"><p>When an update changes a branch (or more in general, a ref) that used to
1028 point at commit A to point at another commit B, it is called a
1029 fast-forward update if and only if B is a descendant of A.</p></div>
1030 <div class="paragraph"><p>In a fast-forward update from A to B, the set of commits that the original
1031 commit A built on top of is a subset of the commits the new commit B
1032 builds on top of. Hence, it does not lose any history.</p></div>
1033 <div class="paragraph"><p>In contrast, a non-fast-forward update will lose history. For example,
1034 suppose you and somebody else started at the same commit X, and you built
1035 a history leading to commit B while the other person built a history
1036 leading to commit A. The history looks like this:</p></div>
1037 <div class="listingblock">
1038 <div class="content">
1039 <pre><tt> B
1041 ---X---A</tt></pre>
1042 </div></div>
1043 <div class="paragraph"><p>Further suppose that the other person already pushed changes leading to A
1044 back to the original repository you two obtained the original commit X.</p></div>
1045 <div class="paragraph"><p>The push done by the other person updated the branch that used to point at
1046 commit X to point at commit A. It is a fast-forward.</p></div>
1047 <div class="paragraph"><p>But if you try to push, you will attempt to update the branch (that
1048 now points at A) with commit B. This does <em>not</em> fast-forward. If you did
1049 so, the changes introduced by commit A will be lost, because everybody
1050 will now start building on top of B.</p></div>
1051 <div class="paragraph"><p>The command by default does not allow an update that is not a fast-forward
1052 to prevent such loss of history.</p></div>
1053 <div class="paragraph"><p>If you do not want to lose your work (history from X to B) nor the work by
1054 the other person (history from X to A), you would need to first fetch the
1055 history from the repository, create a history that contains changes done
1056 by both parties, and push the result back.</p></div>
1057 <div class="paragraph"><p>You can perform "git pull", resolve potential conflicts, and "git push"
1058 the result. A "git pull" will create a merge commit C between commits A
1059 and B.</p></div>
1060 <div class="listingblock">
1061 <div class="content">
1062 <pre><tt> B---C
1064 ---X---A</tt></pre>
1065 </div></div>
1066 <div class="paragraph"><p>Updating A with the resulting merge commit will fast-forward and your
1067 push will be accepted.</p></div>
1068 <div class="paragraph"><p>Alternatively, you can rebase your change between X and B on top of A,
1069 with "git pull --rebase", and push the result back. The rebase will
1070 create a new commit D that builds the change between X and B on top of
1071 A.</p></div>
1072 <div class="listingblock">
1073 <div class="content">
1074 <pre><tt> B D
1076 ---X---A</tt></pre>
1077 </div></div>
1078 <div class="paragraph"><p>Again, updating A with this commit will fast-forward and your push will be
1079 accepted.</p></div>
1080 <div class="paragraph"><p>There is another common situation where you may encounter non-fast-forward
1081 rejection when you try to push, and it is possible even when you are
1082 pushing into a repository nobody else pushes into. After you push commit
1083 A yourself (in the first picture in this section), replace it with "git
1084 commit --amend" to produce commit B, and you try to push it out, because
1085 forgot that you have pushed A out already. In such a case, and only if
1086 you are certain that nobody in the meantime fetched your earlier commit A
1087 (and started building on top of it), you can run "git push --force" to
1088 overwrite it. In other words, "git push --force" is a method reserved for
1089 a case where you do mean to lose history.</p></div>
1090 </div>
1091 <h2 id="_examples">Examples</h2>
1092 <div class="sectionbody">
1093 <div class="dlist"><dl>
1094 <dt class="hdlist1">
1095 git push
1096 </dt>
1097 <dd>
1099 Works like <tt>git push &lt;remote&gt;</tt>, where &lt;remote&gt; is the
1100 current branch&#8217;s remote (or <tt>origin</tt>, if no remote is
1101 configured for the current branch).
1102 </p>
1103 </dd>
1104 <dt class="hdlist1">
1105 git push origin
1106 </dt>
1107 <dd>
1109 Without additional configuration, works like
1110 <tt>git push origin :</tt>.
1111 </p>
1112 <div class="paragraph"><p>The default behavior of this command when no &lt;refspec&gt; is given can be
1113 configured by setting the <tt>push</tt> option of the remote.</p></div>
1114 <div class="paragraph"><p>For example, to default to pushing only the current branch to <tt>origin</tt>
1115 use <tt>git config remote.origin.push HEAD</tt>. Any valid &lt;refspec&gt; (like
1116 the ones in the examples below) can be configured as the default for
1117 <tt>git push origin</tt>.</p></div>
1118 <div class="dlist"><dl>
1119 <dt class="hdlist1">
1120 git push origin
1121 </dt>
1122 <dd>
1124 Push "matching" branches to <tt>origin</tt>. See
1125 &lt;refspec&gt; in the <a href="#OPTIONS">OPTIONS</a> section above for a
1126 description of "matching" branches.
1127 </p>
1128 </dd>
1129 </dl></div>
1130 </dd>
1131 <dt class="hdlist1">
1132 git push origin master
1133 </dt>
1134 <dd>
1136 Find a ref that matches <tt>master</tt> in the source repository
1137 (most likely, it would find <tt>refs/heads/master</tt>), and update
1138 the same ref (e.g. <tt>refs/heads/master</tt>) in <tt>origin</tt> repository
1139 with it. If <tt>master</tt> did not exist remotely, it would be
1140 created.
1141 </p>
1142 </dd>
1143 <dt class="hdlist1">
1144 git push origin HEAD
1145 </dt>
1146 <dd>
1148 A handy way to push the current branch to the same name on the
1149 remote.
1150 </p>
1151 </dd>
1152 <dt class="hdlist1">
1153 git push origin master:satellite/master dev:satellite/dev
1154 </dt>
1155 <dd>
1157 Use the source ref that matches <tt>master</tt> (e.g. <tt>refs/heads/master</tt>)
1158 to update the ref that matches <tt>satellite/master</tt> (most probably
1159 <tt>refs/remotes/satellite/master</tt>) in the <tt>origin</tt> repository, then
1160 do the same for <tt>dev</tt> and <tt>satellite/dev</tt>.
1161 </p>
1162 </dd>
1163 <dt class="hdlist1">
1164 git push origin HEAD:master
1165 </dt>
1166 <dd>
1168 Push the current branch to the remote ref matching <tt>master</tt> in the
1169 <tt>origin</tt> repository. This form is convenient to push the current
1170 branch without thinking about its local name.
1171 </p>
1172 </dd>
1173 <dt class="hdlist1">
1174 git push origin master:refs/heads/experimental
1175 </dt>
1176 <dd>
1178 Create the branch <tt>experimental</tt> in the <tt>origin</tt> repository
1179 by copying the current <tt>master</tt> branch. This form is only
1180 needed to create a new branch or tag in the remote repository when
1181 the local name and the remote name are different; otherwise,
1182 the ref name on its own will work.
1183 </p>
1184 </dd>
1185 <dt class="hdlist1">
1186 git push origin :experimental
1187 </dt>
1188 <dd>
1190 Find a ref that matches <tt>experimental</tt> in the <tt>origin</tt> repository
1191 (e.g. <tt>refs/heads/experimental</tt>), and delete it.
1192 </p>
1193 </dd>
1194 <dt class="hdlist1">
1195 git push origin &#43;dev:master
1196 </dt>
1197 <dd>
1199 Update the origin repository&#8217;s master branch with the dev branch,
1200 allowing non-fast-forward updates. <strong>This can leave unreferenced
1201 commits dangling in the origin repository.</strong> Consider the
1202 following situation, where a fast-forward is not possible:
1203 </p>
1204 <div class="listingblock">
1205 <div class="content">
1206 <pre><tt> o---o---o---A---B origin/master
1208 X---Y---Z dev</tt></pre>
1209 </div></div>
1210 <div class="paragraph"><p>The above command would change the origin repository to</p></div>
1211 <div class="listingblock">
1212 <div class="content">
1213 <pre><tt> A---B (unnamed branch)
1215 o---o---o---X---Y---Z master</tt></pre>
1216 </div></div>
1217 <div class="paragraph"><p>Commits A and B would no longer belong to a branch with a symbolic name,
1218 and so would be unreachable. As such, these commits would be removed by
1219 a <tt>git gc</tt> command on the origin repository.</p></div>
1220 </dd>
1221 </dl></div>
1222 </div>
1223 <h2 id="_git">GIT</h2>
1224 <div class="sectionbody">
1225 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
1226 </div>
1227 <div id="footer">
1228 <div id="footer-text">
1229 Last updated 2011-03-15 23:30:14 UTC
1230 </div>
1231 </div>
1232 </body>
1233 </html>