Autogenerated HTML docs for v1.7.7-290-gc9e7aa
[git/jnareb-git.git] / git-push.html
blobe118547fb3d4aed409dc05ded3b111d75f0c5201
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.5.2" />
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.0em;
122 margin-bottom: 1.5em;
124 div.admonitionblock {
125 margin-top: 2.0em;
126 margin-bottom: 2.0em;
127 margin-right: 10%;
128 color: #606060;
131 div.content { /* Block element content. */
132 padding: 0;
135 /* Block element titles. */
136 div.title, caption.title {
137 color: #527bbd;
138 font-family: sans-serif;
139 font-weight: bold;
140 text-align: left;
141 margin-top: 1.0em;
142 margin-bottom: 0.5em;
144 div.title + * {
145 margin-top: 0;
148 td div.title:first-child {
149 margin-top: 0.0em;
151 div.content div.title:first-child {
152 margin-top: 0.0em;
154 div.content + div.title {
155 margin-top: 0.0em;
158 div.sidebarblock > div.content {
159 background: #ffffee;
160 border: 1px solid silver;
161 padding: 0.5em;
164 div.listingblock > div.content {
165 border: 1px solid silver;
166 background: #f4f4f4;
167 padding: 0.5em;
170 div.quoteblock, div.verseblock {
171 padding-left: 1.0em;
172 margin-left: 1.0em;
173 margin-right: 10%;
174 border-left: 5px solid #dddddd;
175 color: #777777;
178 div.quoteblock > div.attribution {
179 padding-top: 0.5em;
180 text-align: right;
183 div.verseblock > div.content {
184 white-space: pre;
186 div.verseblock > div.attribution {
187 padding-top: 0.75em;
188 text-align: left;
190 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
191 div.verseblock + div.attribution {
192 text-align: left;
195 div.admonitionblock .icon {
196 vertical-align: top;
197 font-size: 1.1em;
198 font-weight: bold;
199 text-decoration: underline;
200 color: #527bbd;
201 padding-right: 0.5em;
203 div.admonitionblock td.content {
204 padding-left: 0.5em;
205 border-left: 3px solid #dddddd;
208 div.exampleblock > div.content {
209 border-left: 3px solid #dddddd;
210 padding-left: 0.5em;
213 div.imageblock div.content { padding-left: 0; }
214 span.image img { border-style: none; }
215 a.image:visited { color: white; }
217 dl {
218 margin-top: 0.8em;
219 margin-bottom: 0.8em;
221 dt {
222 margin-top: 0.5em;
223 margin-bottom: 0;
224 font-style: normal;
225 color: navy;
227 dd > *:first-child {
228 margin-top: 0.1em;
231 ul, ol {
232 list-style-position: outside;
234 ol.arabic {
235 list-style-type: decimal;
237 ol.loweralpha {
238 list-style-type: lower-alpha;
240 ol.upperalpha {
241 list-style-type: upper-alpha;
243 ol.lowerroman {
244 list-style-type: lower-roman;
246 ol.upperroman {
247 list-style-type: upper-roman;
250 div.compact ul, div.compact ol,
251 div.compact p, div.compact p,
252 div.compact div, div.compact div {
253 margin-top: 0.1em;
254 margin-bottom: 0.1em;
257 div.tableblock > table {
258 border: 3px solid #527bbd;
260 thead, p.table.header {
261 font-family: sans-serif;
262 font-weight: bold;
264 tfoot {
265 font-weight: bold;
267 td > div.verse {
268 white-space: pre;
270 p.table {
271 margin-top: 0;
273 /* Because the table frame attribute is overriden by CSS in most browsers. */
274 div.tableblock > table[frame="void"] {
275 border-style: none;
277 div.tableblock > table[frame="hsides"] {
278 border-left-style: none;
279 border-right-style: none;
281 div.tableblock > table[frame="vsides"] {
282 border-top-style: none;
283 border-bottom-style: none;
287 div.hdlist {
288 margin-top: 0.8em;
289 margin-bottom: 0.8em;
291 div.hdlist tr {
292 padding-bottom: 15px;
294 dt.hdlist1.strong, td.hdlist1.strong {
295 font-weight: bold;
297 td.hdlist1 {
298 vertical-align: top;
299 font-style: normal;
300 padding-right: 0.8em;
301 color: navy;
303 td.hdlist2 {
304 vertical-align: top;
306 div.hdlist.compact tr {
307 margin: 0;
308 padding-bottom: 0;
311 .comment {
312 background: yellow;
315 .footnote, .footnoteref {
316 font-size: 0.8em;
319 span.footnote, span.footnoteref {
320 vertical-align: super;
323 #footnotes {
324 margin: 20px 0 20px 0;
325 padding: 7px 0 0 0;
328 #footnotes div.footnote {
329 margin: 0 0 5px 0;
332 #footnotes hr {
333 border: none;
334 border-top: 1px solid silver;
335 height: 1px;
336 text-align: left;
337 margin-left: 0;
338 width: 20%;
339 min-width: 100px;
343 @media print {
344 div#footer-badges { display: none; }
347 div#toc {
348 margin-bottom: 2.5em;
351 div#toctitle {
352 color: #527bbd;
353 font-family: sans-serif;
354 font-size: 1.1em;
355 font-weight: bold;
356 margin-top: 1.0em;
357 margin-bottom: 0.1em;
360 div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
361 margin-top: 0;
362 margin-bottom: 0;
364 div.toclevel2 {
365 margin-left: 2em;
366 font-size: 0.9em;
368 div.toclevel3 {
369 margin-left: 4em;
370 font-size: 0.9em;
372 div.toclevel4 {
373 margin-left: 6em;
374 font-size: 0.9em;
376 /* Overrides for manpage documents */
377 h1 {
378 padding-top: 0.5em;
379 padding-bottom: 0.5em;
380 border-top: 2px solid silver;
381 border-bottom: 2px solid silver;
383 h2 {
384 border-style: none;
386 div.sectionbody {
387 margin-left: 5%;
390 @media print {
391 div#toc { display: none; }
394 /* Workarounds for IE6's broken and incomplete CSS2. */
396 div.sidebar-content {
397 background: #ffffee;
398 border: 1px solid silver;
399 padding: 0.5em;
401 div.sidebar-title, div.image-title {
402 color: #527bbd;
403 font-family: sans-serif;
404 font-weight: bold;
405 margin-top: 0.0em;
406 margin-bottom: 0.5em;
409 div.listingblock div.content {
410 border: 1px solid silver;
411 background: #f4f4f4;
412 padding: 0.5em;
415 div.quoteblock-attribution {
416 padding-top: 0.5em;
417 text-align: right;
420 div.verseblock-content {
421 white-space: pre;
423 div.verseblock-attribution {
424 padding-top: 0.75em;
425 text-align: left;
428 div.exampleblock-content {
429 border-left: 3px solid #dddddd;
430 padding-left: 0.5em;
433 /* IE6 sets dynamically generated links as visited. */
434 div#toc a:visited { color: blue; }
435 </style>
436 <script type="text/javascript">
437 /*<![CDATA[*/
438 window.onload = function(){asciidoc.footnotes();}
439 var asciidoc = { // Namespace.
441 /////////////////////////////////////////////////////////////////////
442 // Table Of Contents generator
443 /////////////////////////////////////////////////////////////////////
445 /* Author: Mihai Bazon, September 2002
446 * http://students.infoiasi.ro/~mishoo
448 * Table Of Content generator
449 * Version: 0.4
451 * Feel free to use this script under the terms of the GNU General Public
452 * License, as long as you do not remove or alter this notice.
455 /* modified by Troy D. Hanson, September 2006. License: GPL */
456 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
458 // toclevels = 1..4.
459 toc: function (toclevels) {
461 function getText(el) {
462 var text = "";
463 for (var i = el.firstChild; i != null; i = i.nextSibling) {
464 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
465 text += i.data;
466 else if (i.firstChild != null)
467 text += getText(i);
469 return text;
472 function TocEntry(el, text, toclevel) {
473 this.element = el;
474 this.text = text;
475 this.toclevel = toclevel;
478 function tocEntries(el, toclevels) {
479 var result = new Array;
480 var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');
481 // Function that scans the DOM tree for header elements (the DOM2
482 // nodeIterator API would be a better technique but not supported by all
483 // browsers).
484 var iterate = function (el) {
485 for (var i = el.firstChild; i != null; i = i.nextSibling) {
486 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
487 var mo = re.exec(i.tagName);
488 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
489 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
491 iterate(i);
495 iterate(el);
496 return result;
499 var toc = document.getElementById("toc");
500 var entries = tocEntries(document.getElementById("content"), toclevels);
501 for (var i = 0; i < entries.length; ++i) {
502 var entry = entries[i];
503 if (entry.element.id == "")
504 entry.element.id = "_toc_" + i;
505 var a = document.createElement("a");
506 a.href = "#" + entry.element.id;
507 a.appendChild(document.createTextNode(entry.text));
508 var div = document.createElement("div");
509 div.appendChild(a);
510 div.className = "toclevel" + entry.toclevel;
511 toc.appendChild(div);
513 if (entries.length == 0)
514 toc.parentNode.removeChild(toc);
518 /////////////////////////////////////////////////////////////////////
519 // Footnotes generator
520 /////////////////////////////////////////////////////////////////////
522 /* Based on footnote generation code from:
523 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
526 footnotes: function () {
527 var cont = document.getElementById("content");
528 var noteholder = document.getElementById("footnotes");
529 var spans = cont.getElementsByTagName("span");
530 var refs = {};
531 var n = 0;
532 for (i=0; i<spans.length; i++) {
533 if (spans[i].className == "footnote") {
534 n++;
535 // Use [\s\S] in place of . so multi-line matches work.
536 // Because JavaScript has no s (dotall) regex flag.
537 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
538 noteholder.innerHTML +=
539 "<div class='footnote' id='_footnote_" + n + "'>" +
540 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
541 n + "</a>. " + note + "</div>";
542 spans[i].innerHTML =
543 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
544 "' title='View footnote' class='footnote'>" + n + "</a>]";
545 var id =spans[i].getAttribute("id");
546 if (id != null) refs["#"+id] = n;
549 if (n == 0)
550 noteholder.parentNode.removeChild(noteholder);
551 else {
552 // Process footnoterefs.
553 for (i=0; i<spans.length; i++) {
554 if (spans[i].className == "footnoteref") {
555 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
556 href = href.match(/#.*/)[0]; // Because IE return full URL.
557 n = refs[href];
558 spans[i].innerHTML =
559 "[<a href='#_footnote_" + n +
560 "' title='View footnote' class='footnote'>" + n + "</a>]";
567 /*]]>*/
568 </script>
569 </head>
570 <body>
571 <div id="header">
572 <h1>
573 git-push(1) Manual Page
574 </h1>
575 <h2>NAME</h2>
576 <div class="sectionbody">
577 <p>git-push -
578 Update remote refs along with associated objects
579 </p>
580 </div>
581 </div>
582 <div id="content">
583 <h2 id="_synopsis">SYNOPSIS</h2>
584 <div class="sectionbody">
585 <div class="verseblock">
586 <div class="verseblock-content"><em>git push</em> [--all | --mirror | --tags] [-n | --dry-run] [--receive-pack=&lt;git-receive-pack&gt;]
587 [--repo=&lt;repository&gt;] [-f | --force] [-v | --verbose] [-u | --set-upstream]
588 [&lt;repository&gt; [&lt;refspec&gt;&#8230;]]</div>
589 <div class="verseblock-attribution">
590 </div></div>
591 </div>
592 <h2 id="_description">DESCRIPTION</h2>
593 <div class="sectionbody">
594 <div class="paragraph"><p>Updates remote refs using local refs, while sending objects
595 necessary to complete the given refs.</p></div>
596 <div class="paragraph"><p>You can make interesting things happen to a repository
597 every time you push into it, by setting up <em>hooks</em> there. See
598 documentation for <a href="git-receive-pack.html">git-receive-pack(1)</a>.</p></div>
599 </div>
600 <h2 id="_options_a_id_options_a">OPTIONS<a id="OPTIONS"></a></h2>
601 <div class="sectionbody">
602 <div class="dlist"><dl>
603 <dt class="hdlist1">
604 &lt;repository&gt;
605 </dt>
606 <dd>
608 The "remote" repository that is destination of a push
609 operation. This parameter can be either a URL
610 (see the section <a href="#URLS">GIT URLS</a> below) or the name
611 of a remote (see the section <a href="#REMOTES">REMOTES</a> below).
612 </p>
613 </dd>
614 <dt class="hdlist1">
615 &lt;refspec&gt;&#8230;
616 </dt>
617 <dd>
619 The format of a &lt;refspec&gt; parameter is an optional plus
620 <tt>&#43;</tt>, followed by the source ref &lt;src&gt;, followed
621 by a colon <tt>:</tt>, followed by the destination ref &lt;dst&gt;.
622 It is used to specify with what &lt;src&gt; object the &lt;dst&gt; ref
623 in the remote repository is to be updated.
624 </p>
625 <div class="paragraph"><p>The &lt;src&gt; is often the name of the branch you would want to push, but
626 it can be any arbitrary "SHA-1 expression", such as <tt>master~4</tt> or
627 <tt>HEAD</tt> (see <a href="gitrevisions.html">gitrevisions(7)</a>).</p></div>
628 <div class="paragraph"><p>The &lt;dst&gt; tells which ref on the remote side is updated with this
629 push. Arbitrary expressions cannot be used here, an actual ref must
630 be named. If <tt>:</tt>&lt;dst&gt; is omitted, the same ref as &lt;src&gt; will be
631 updated.</p></div>
632 <div class="paragraph"><p>The object referenced by &lt;src&gt; is used to update the &lt;dst&gt; reference
633 on the remote side, but by default this is only allowed if the
634 update can fast-forward &lt;dst&gt;. By having the optional leading <tt>&#43;</tt>,
635 you can tell git to update the &lt;dst&gt; ref even when the update is not a
636 fast-forward. This does <strong>not</strong> attempt to merge &lt;src&gt; into &lt;dst&gt;. See
637 EXAMPLES below for details.</p></div>
638 <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>
639 <div class="paragraph"><p>Pushing an empty &lt;src&gt; allows you to delete the &lt;dst&gt; ref from
640 the remote repository.</p></div>
641 <div class="paragraph"><p>The special refspec <tt>:</tt> (or <tt>&#43;:</tt> to allow non-fast-forward updates)
642 directs git to push "matching" branches: for every branch that exists on
643 the local side, the remote side is updated if a branch of the same name
644 already exists on the remote side. This is the default operation mode
645 if no explicit refspec is found (that is neither on the command line
646 nor in any Push line of the corresponding remotes file---see below).</p></div>
647 </dd>
648 <dt class="hdlist1">
649 --all
650 </dt>
651 <dd>
653 Instead of naming each ref to push, specifies that all
654 refs under <tt>refs/heads/</tt> be pushed.
655 </p>
656 </dd>
657 <dt class="hdlist1">
658 --mirror
659 </dt>
660 <dd>
662 Instead of naming each ref to push, specifies that all
663 refs under <tt>refs/</tt> (which includes but is not
664 limited to <tt>refs/heads/</tt>, <tt>refs/remotes/</tt>, and <tt>refs/tags/</tt>)
665 be mirrored to the remote repository. Newly created local
666 refs will be pushed to the remote end, locally updated refs
667 will be force updated on the remote end, and deleted refs
668 will be removed from the remote end. This is the default
669 if the configuration option <tt>remote.&lt;remote&gt;.mirror</tt> is
670 set.
671 </p>
672 </dd>
673 <dt class="hdlist1">
675 </dt>
676 <dt class="hdlist1">
677 --dry-run
678 </dt>
679 <dd>
681 Do everything except actually send the updates.
682 </p>
683 </dd>
684 <dt class="hdlist1">
685 --porcelain
686 </dt>
687 <dd>
689 Produce machine-readable output. The output status line for each ref
690 will be tab-separated and sent to stdout instead of stderr. The full
691 symbolic names of the refs will be given.
692 </p>
693 </dd>
694 <dt class="hdlist1">
695 --delete
696 </dt>
697 <dd>
699 All listed refs are deleted from the remote repository. This is
700 the same as prefixing all refs with a colon.
701 </p>
702 </dd>
703 <dt class="hdlist1">
704 --tags
705 </dt>
706 <dd>
708 All refs under <tt>refs/tags</tt> are pushed, in
709 addition to refspecs explicitly listed on the command
710 line.
711 </p>
712 </dd>
713 <dt class="hdlist1">
714 --receive-pack=&lt;git-receive-pack&gt;
715 </dt>
716 <dt class="hdlist1">
717 --exec=&lt;git-receive-pack&gt;
718 </dt>
719 <dd>
721 Path to the <em>git-receive-pack</em> program on the remote
722 end. Sometimes useful when pushing to a remote
723 repository over ssh, and you do not have the program in
724 a directory on the default $PATH.
725 </p>
726 </dd>
727 <dt class="hdlist1">
729 </dt>
730 <dt class="hdlist1">
731 --force
732 </dt>
733 <dd>
735 Usually, the command refuses to update a remote ref that is
736 not an ancestor of the local ref used to overwrite it.
737 This flag disables the check. This can cause the
738 remote repository to lose commits; use it with care.
739 </p>
740 </dd>
741 <dt class="hdlist1">
742 --repo=&lt;repository&gt;
743 </dt>
744 <dd>
746 This option is only relevant if no &lt;repository&gt; argument is
747 passed in the invocation. In this case, <em>git push</em> derives the
748 remote name from the current branch: If it tracks a remote
749 branch, then that remote repository is pushed to. Otherwise,
750 the name "origin" is used. For this latter case, this option
751 can be used to override the name "origin". In other words,
752 the difference between these two commands
753 </p>
754 <div class="listingblock">
755 <div class="content">
756 <pre><tt>git push public #1
757 git push --repo=public #2</tt></pre>
758 </div></div>
759 <div class="paragraph"><p>is that #1 always pushes to "public" whereas #2 pushes to "public"
760 only if the current branch does not track a remote branch. This is
761 useful if you write an alias or script around <em>git push</em>.</p></div>
762 </dd>
763 <dt class="hdlist1">
765 </dt>
766 <dt class="hdlist1">
767 --set-upstream
768 </dt>
769 <dd>
771 For every branch that is up to date or successfully pushed, add
772 upstream (tracking) reference, used by argument-less
773 <a href="git-pull.html">git-pull(1)</a> and other commands. For more information,
774 see <em>branch.&lt;name&gt;.merge</em> in <a href="git-config.html">git-config(1)</a>.
775 </p>
776 </dd>
777 <dt class="hdlist1">
778 --thin
779 </dt>
780 <dt class="hdlist1">
781 --no-thin
782 </dt>
783 <dd>
785 These options are passed to <a href="git-send-pack.html">git-send-pack(1)</a>. A thin transfer
786 significantly reduces the amount of sent data when the sender and
787 receiver share many of the same objects in common. The default is
788 --thin.
789 </p>
790 </dd>
791 <dt class="hdlist1">
793 </dt>
794 <dt class="hdlist1">
795 --quiet
796 </dt>
797 <dd>
799 Suppress all output, including the listing of updated refs,
800 unless an error occurs. Progress is not reported to the standard
801 error stream.
802 </p>
803 </dd>
804 <dt class="hdlist1">
806 </dt>
807 <dt class="hdlist1">
808 --verbose
809 </dt>
810 <dd>
812 Run verbosely.
813 </p>
814 </dd>
815 <dt class="hdlist1">
816 --progress
817 </dt>
818 <dd>
820 Progress status is reported on the standard error stream
821 by default when it is attached to a terminal, unless -q
822 is specified. This flag forces progress status even if the
823 standard error stream is not directed to a terminal.
824 </p>
825 </dd>
826 <dt class="hdlist1">
827 --recurse-submodules=check
828 </dt>
829 <dd>
831 Check whether all submodule commits used by the revisions to be
832 pushed are available on a remote tracking branch. Otherwise the
833 push will be aborted and the command will exit with non-zero status.
834 </p>
835 </dd>
836 </dl></div>
837 </div>
838 <h2 id="_git_urls_a_id_urls_a">GIT URLS<a id="URLS"></a></h2>
839 <div class="sectionbody">
840 <div class="paragraph"><p>In general, URLs contain information about the transport protocol, the
841 address of the remote server, and the path to the repository.
842 Depending on the transport protocol, some of this information may be
843 absent.</p></div>
844 <div class="paragraph"><p>Git natively supports ssh, git, http, https, ftp, ftps, and rsync
845 protocols. The following syntaxes may be used with them:</p></div>
846 <div class="ulist"><ul>
847 <li>
849 ssh://&#91;user@&#93;host.xz&#91;:port&#93;/path/to/repo.git/
850 </p>
851 </li>
852 <li>
854 git://host.xz&#91;:port&#93;/path/to/repo.git/
855 </p>
856 </li>
857 <li>
859 http&#91;s&#93;://host.xz&#91;:port&#93;/path/to/repo.git/
860 </p>
861 </li>
862 <li>
864 ftp&#91;s&#93;://host.xz&#91;:port&#93;/path/to/repo.git/
865 </p>
866 </li>
867 <li>
869 rsync://host.xz/path/to/repo.git/
870 </p>
871 </li>
872 </ul></div>
873 <div class="paragraph"><p>An alternative scp-like syntax may also be used with the ssh protocol:</p></div>
874 <div class="ulist"><ul>
875 <li>
877 &#91;user@&#93;host.xz:path/to/repo.git/
878 </p>
879 </li>
880 </ul></div>
881 <div class="paragraph"><p>The ssh and git protocols additionally support ~username expansion:</p></div>
882 <div class="ulist"><ul>
883 <li>
885 ssh://&#91;user@&#93;host.xz&#91;:port&#93;/~&#91;user&#93;/path/to/repo.git/
886 </p>
887 </li>
888 <li>
890 git://host.xz&#91;:port&#93;/~&#91;user&#93;/path/to/repo.git/
891 </p>
892 </li>
893 <li>
895 &#91;user@&#93;host.xz:/~&#91;user&#93;/path/to/repo.git/
896 </p>
897 </li>
898 </ul></div>
899 <div class="paragraph"><p>For local repositories, also supported by git natively, the following
900 syntaxes may be used:</p></div>
901 <div class="ulist"><ul>
902 <li>
904 /path/to/repo.git/
905 </p>
906 </li>
907 <li>
909 <a href="file:///path/to/repo.git/">file:///path/to/repo.git/</a>
910 </p>
911 </li>
912 </ul></div>
913 <div class="paragraph"><p>These two syntaxes are mostly equivalent, except when cloning, when
914 the former implies --local option. See <a href="git-clone.html">git-clone(1)</a> for
915 details.</p></div>
916 <div class="paragraph"><p>When git doesn&#8217;t know how to handle a certain transport protocol, it
917 attempts to use the <em>remote-&lt;transport&gt;</em> remote helper, if one
918 exists. To explicitly request a remote helper, the following syntax
919 may be used:</p></div>
920 <div class="ulist"><ul>
921 <li>
923 &lt;transport&gt;::&lt;address&gt;
924 </p>
925 </li>
926 </ul></div>
927 <div class="paragraph"><p>where &lt;address&gt; may be a path, a server and path, or an arbitrary
928 URL-like string recognized by the specific remote helper being
929 invoked. See <a href="git-remote-helpers.html">git-remote-helpers(1)</a> for details.</p></div>
930 <div class="paragraph"><p>If there are a large number of similarly-named remote repositories and
931 you want to use a different format for them (such that the URLs you
932 use will be rewritten into URLs that work), you can create a
933 configuration section of the form:</p></div>
934 <div class="listingblock">
935 <div class="content">
936 <pre><tt> [url "&lt;actual url base&gt;"]
937 insteadOf = &lt;other url base&gt;</tt></pre>
938 </div></div>
939 <div class="paragraph"><p>For example, with this:</p></div>
940 <div class="listingblock">
941 <div class="content">
942 <pre><tt> [url "git://git.host.xz/"]
943 insteadOf = host.xz:/path/to/
944 insteadOf = work:</tt></pre>
945 </div></div>
946 <div class="paragraph"><p>a URL like "work:repo.git" or like "host.xz:/path/to/repo.git" will be
947 rewritten in any context that takes a URL to be "git://git.host.xz/repo.git".</p></div>
948 <div class="paragraph"><p>If you want to rewrite URLs for push only, you can create a
949 configuration section of the form:</p></div>
950 <div class="listingblock">
951 <div class="content">
952 <pre><tt> [url "&lt;actual url base&gt;"]
953 pushInsteadOf = &lt;other url base&gt;</tt></pre>
954 </div></div>
955 <div class="paragraph"><p>For example, with this:</p></div>
956 <div class="listingblock">
957 <div class="content">
958 <pre><tt> [url "ssh://example.org/"]
959 pushInsteadOf = git://example.org/</tt></pre>
960 </div></div>
961 <div class="paragraph"><p>a URL like "git://example.org/path/to/repo.git" will be rewritten to
962 "ssh://example.org/path/to/repo.git" for pushes, but pulls will still
963 use the original URL.</p></div>
964 </div>
965 <h2 id="_remotes_a_id_remotes_a">REMOTES<a id="REMOTES"></a></h2>
966 <div class="sectionbody">
967 <div class="paragraph"><p>The name of one of the following can be used instead
968 of a URL as <tt>&lt;repository&gt;</tt> argument:</p></div>
969 <div class="ulist"><ul>
970 <li>
972 a remote in the git configuration file: <tt>$GIT_DIR/config</tt>,
973 </p>
974 </li>
975 <li>
977 a file in the <tt>$GIT_DIR/remotes</tt> directory, or
978 </p>
979 </li>
980 <li>
982 a file in the <tt>$GIT_DIR/branches</tt> directory.
983 </p>
984 </li>
985 </ul></div>
986 <div class="paragraph"><p>All of these also allow you to omit the refspec from the command line
987 because they each contain a refspec which git will use by default.</p></div>
988 <h3 id="_named_remote_in_configuration_file">Named remote in configuration file</h3><div style="clear:left"></div>
989 <div class="paragraph"><p>You can choose to provide the name of a remote which you had previously
990 configured using <a href="git-remote.html">git-remote(1)</a>, <a href="git-config.html">git-config(1)</a>
991 or even by a manual edit to the <tt>$GIT_DIR/config</tt> file. The URL of
992 this remote will be used to access the repository. The refspec
993 of this remote will be used by default when you do
994 not provide a refspec on the command line. The entry in the
995 config file would appear like this:</p></div>
996 <div class="listingblock">
997 <div class="content">
998 <pre><tt> [remote "&lt;name&gt;"]
999 url = &lt;url&gt;
1000 pushurl = &lt;pushurl&gt;
1001 push = &lt;refspec&gt;
1002 fetch = &lt;refspec&gt;</tt></pre>
1003 </div></div>
1004 <div class="paragraph"><p>The <tt>&lt;pushurl&gt;</tt> is used for pushes only. It is optional and defaults
1005 to <tt>&lt;url&gt;</tt>.</p></div>
1006 <h3 id="_named_file_in_tt_git_dir_remotes_tt">Named file in <tt>$GIT_DIR/remotes</tt></h3><div style="clear:left"></div>
1007 <div class="paragraph"><p>You can choose to provide the name of a
1008 file in <tt>$GIT_DIR/remotes</tt>. The URL
1009 in this file will be used to access the repository. The refspec
1010 in this file will be used as default when you do not
1011 provide a refspec on the command line. This file should have the
1012 following format:</p></div>
1013 <div class="listingblock">
1014 <div class="content">
1015 <pre><tt> URL: one of the above URL format
1016 Push: &lt;refspec&gt;
1017 Pull: &lt;refspec&gt;</tt></pre>
1018 </div></div>
1019 <div class="paragraph"><p><tt>Push:</tt> lines are used by <em>git push</em> and
1020 <tt>Pull:</tt> lines are used by <em>git pull</em> and <em>git fetch</em>.
1021 Multiple <tt>Push:</tt> and <tt>Pull:</tt> lines may
1022 be specified for additional branch mappings.</p></div>
1023 <h3 id="_named_file_in_tt_git_dir_branches_tt">Named file in <tt>$GIT_DIR/branches</tt></h3><div style="clear:left"></div>
1024 <div class="paragraph"><p>You can choose to provide the name of a
1025 file in <tt>$GIT_DIR/branches</tt>.
1026 The URL in this file will be used to access the repository.
1027 This file should have the following format:</p></div>
1028 <div class="listingblock">
1029 <div class="content">
1030 <pre><tt> &lt;url&gt;#&lt;head&gt;</tt></pre>
1031 </div></div>
1032 <div class="paragraph"><p><tt>&lt;url&gt;</tt> is required; <tt>#&lt;head&gt;</tt> is optional.</p></div>
1033 <div class="paragraph"><p>Depending on the operation, git will use one of the following
1034 refspecs, if you don&#8217;t provide one on the command line.
1035 <tt>&lt;branch&gt;</tt> is the name of this file in <tt>$GIT_DIR/branches</tt> and
1036 <tt>&lt;head&gt;</tt> defaults to <tt>master</tt>.</p></div>
1037 <div class="paragraph"><p>git fetch uses:</p></div>
1038 <div class="listingblock">
1039 <div class="content">
1040 <pre><tt> refs/heads/&lt;head&gt;:refs/heads/&lt;branch&gt;</tt></pre>
1041 </div></div>
1042 <div class="paragraph"><p>git push uses:</p></div>
1043 <div class="listingblock">
1044 <div class="content">
1045 <pre><tt> HEAD:refs/heads/&lt;head&gt;</tt></pre>
1046 </div></div>
1047 </div>
1048 <h2 id="_output">OUTPUT</h2>
1049 <div class="sectionbody">
1050 <div class="paragraph"><p>The output of "git push" depends on the transport method used; this
1051 section describes the output when pushing over the git protocol (either
1052 locally or via ssh).</p></div>
1053 <div class="paragraph"><p>The status of the push is output in tabular form, with each line
1054 representing the status of a single ref. Each line is of the form:</p></div>
1055 <div class="listingblock">
1056 <div class="content">
1057 <pre><tt> &lt;flag&gt; &lt;summary&gt; &lt;from&gt; -&gt; &lt;to&gt; (&lt;reason&gt;)</tt></pre>
1058 </div></div>
1059 <div class="paragraph"><p>If --porcelain is used, then each line of the output is of the form:</p></div>
1060 <div class="listingblock">
1061 <div class="content">
1062 <pre><tt> &lt;flag&gt; \t &lt;from&gt;:&lt;to&gt; \t &lt;summary&gt; (&lt;reason&gt;)</tt></pre>
1063 </div></div>
1064 <div class="paragraph"><p>The status of up-to-date refs is shown only if --porcelain or --verbose
1065 option is used.</p></div>
1066 <div class="dlist"><dl>
1067 <dt class="hdlist1">
1068 flag
1069 </dt>
1070 <dd>
1072 A single character indicating the status of the ref:
1073 </p>
1074 <div class="dlist"><dl>
1075 <dt class="hdlist1">
1076 (space)
1077 </dt>
1078 <dd>
1080 for a successfully pushed fast-forward;
1081 </p>
1082 </dd>
1083 <dt class="hdlist1">
1084 <tt>&#43;</tt>
1085 </dt>
1086 <dd>
1088 for a successful forced update;
1089 </p>
1090 </dd>
1091 <dt class="hdlist1">
1092 <tt>-</tt>
1093 </dt>
1094 <dd>
1096 for a successfully deleted ref;
1097 </p>
1098 </dd>
1099 <dt class="hdlist1">
1100 <tt>*</tt>
1101 </dt>
1102 <dd>
1104 for a successfully pushed new ref;
1105 </p>
1106 </dd>
1107 <dt class="hdlist1">
1108 <tt>!</tt>
1109 </dt>
1110 <dd>
1112 for a ref that was rejected or failed to push; and
1113 </p>
1114 </dd>
1115 <dt class="hdlist1">
1116 <tt>=</tt>
1117 </dt>
1118 <dd>
1120 for a ref that was up to date and did not need pushing.
1121 </p>
1122 </dd>
1123 </dl></div>
1124 </dd>
1125 <dt class="hdlist1">
1126 summary
1127 </dt>
1128 <dd>
1130 For a successfully pushed ref, the summary shows the old and new
1131 values of the ref in a form suitable for using as an argument to
1132 <tt>git log</tt> (this is <tt>&lt;old&gt;..&lt;new&gt;</tt> in most cases, and
1133 <tt>&lt;old&gt;...&lt;new&gt;</tt> for forced non-fast-forward updates).
1134 </p>
1135 <div class="paragraph"><p>For a failed update, more details are given:</p></div>
1136 <div class="dlist"><dl>
1137 <dt class="hdlist1">
1138 rejected
1139 </dt>
1140 <dd>
1142 Git did not try to send the ref at all, typically because it
1143 is not a fast-forward and you did not force the update.
1144 </p>
1145 </dd>
1146 <dt class="hdlist1">
1147 remote rejected
1148 </dt>
1149 <dd>
1151 The remote end refused the update. Usually caused by a hook
1152 on the remote side, or because the remote repository has one
1153 of the following safety options in effect:
1154 <tt>receive.denyCurrentBranch</tt> (for pushes to the checked out
1155 branch), <tt>receive.denyNonFastForwards</tt> (for forced
1156 non-fast-forward updates), <tt>receive.denyDeletes</tt> or
1157 <tt>receive.denyDeleteCurrent</tt>. See <a href="git-config.html">git-config(1)</a>.
1158 </p>
1159 </dd>
1160 <dt class="hdlist1">
1161 remote failure
1162 </dt>
1163 <dd>
1165 The remote end did not report the successful update of the ref,
1166 perhaps because of a temporary error on the remote side, a
1167 break in the network connection, or other transient error.
1168 </p>
1169 </dd>
1170 </dl></div>
1171 </dd>
1172 <dt class="hdlist1">
1173 from
1174 </dt>
1175 <dd>
1177 The name of the local ref being pushed, minus its
1178 <tt>refs/&lt;type&gt;/</tt> prefix. In the case of deletion, the
1179 name of the local ref is omitted.
1180 </p>
1181 </dd>
1182 <dt class="hdlist1">
1184 </dt>
1185 <dd>
1187 The name of the remote ref being updated, minus its
1188 <tt>refs/&lt;type&gt;/</tt> prefix.
1189 </p>
1190 </dd>
1191 <dt class="hdlist1">
1192 reason
1193 </dt>
1194 <dd>
1196 A human-readable explanation. In the case of successfully pushed
1197 refs, no explanation is needed. For a failed ref, the reason for
1198 failure is described.
1199 </p>
1200 </dd>
1201 </dl></div>
1202 </div>
1203 <h2 id="_note_about_fast_forwards">Note about fast-forwards</h2>
1204 <div class="sectionbody">
1205 <div class="paragraph"><p>When an update changes a branch (or more in general, a ref) that used to
1206 point at commit A to point at another commit B, it is called a
1207 fast-forward update if and only if B is a descendant of A.</p></div>
1208 <div class="paragraph"><p>In a fast-forward update from A to B, the set of commits that the original
1209 commit A built on top of is a subset of the commits the new commit B
1210 builds on top of. Hence, it does not lose any history.</p></div>
1211 <div class="paragraph"><p>In contrast, a non-fast-forward update will lose history. For example,
1212 suppose you and somebody else started at the same commit X, and you built
1213 a history leading to commit B while the other person built a history
1214 leading to commit A. The history looks like this:</p></div>
1215 <div class="listingblock">
1216 <div class="content">
1217 <pre><tt> B
1219 ---X---A</tt></pre>
1220 </div></div>
1221 <div class="paragraph"><p>Further suppose that the other person already pushed changes leading to A
1222 back to the original repository you two obtained the original commit X.</p></div>
1223 <div class="paragraph"><p>The push done by the other person updated the branch that used to point at
1224 commit X to point at commit A. It is a fast-forward.</p></div>
1225 <div class="paragraph"><p>But if you try to push, you will attempt to update the branch (that
1226 now points at A) with commit B. This does <em>not</em> fast-forward. If you did
1227 so, the changes introduced by commit A will be lost, because everybody
1228 will now start building on top of B.</p></div>
1229 <div class="paragraph"><p>The command by default does not allow an update that is not a fast-forward
1230 to prevent such loss of history.</p></div>
1231 <div class="paragraph"><p>If you do not want to lose your work (history from X to B) nor the work by
1232 the other person (history from X to A), you would need to first fetch the
1233 history from the repository, create a history that contains changes done
1234 by both parties, and push the result back.</p></div>
1235 <div class="paragraph"><p>You can perform "git pull", resolve potential conflicts, and "git push"
1236 the result. A "git pull" will create a merge commit C between commits A
1237 and B.</p></div>
1238 <div class="listingblock">
1239 <div class="content">
1240 <pre><tt> B---C
1242 ---X---A</tt></pre>
1243 </div></div>
1244 <div class="paragraph"><p>Updating A with the resulting merge commit will fast-forward and your
1245 push will be accepted.</p></div>
1246 <div class="paragraph"><p>Alternatively, you can rebase your change between X and B on top of A,
1247 with "git pull --rebase", and push the result back. The rebase will
1248 create a new commit D that builds the change between X and B on top of
1249 A.</p></div>
1250 <div class="listingblock">
1251 <div class="content">
1252 <pre><tt> B D
1254 ---X---A</tt></pre>
1255 </div></div>
1256 <div class="paragraph"><p>Again, updating A with this commit will fast-forward and your push will be
1257 accepted.</p></div>
1258 <div class="paragraph"><p>There is another common situation where you may encounter non-fast-forward
1259 rejection when you try to push, and it is possible even when you are
1260 pushing into a repository nobody else pushes into. After you push commit
1261 A yourself (in the first picture in this section), replace it with "git
1262 commit --amend" to produce commit B, and you try to push it out, because
1263 forgot that you have pushed A out already. In such a case, and only if
1264 you are certain that nobody in the meantime fetched your earlier commit A
1265 (and started building on top of it), you can run "git push --force" to
1266 overwrite it. In other words, "git push --force" is a method reserved for
1267 a case where you do mean to lose history.</p></div>
1268 </div>
1269 <h2 id="_examples">Examples</h2>
1270 <div class="sectionbody">
1271 <div class="dlist"><dl>
1272 <dt class="hdlist1">
1273 <tt>git push</tt>
1274 </dt>
1275 <dd>
1277 Works like <tt>git push &lt;remote&gt;</tt>, where &lt;remote&gt; is the
1278 current branch&#8217;s remote (or <tt>origin</tt>, if no remote is
1279 configured for the current branch).
1280 </p>
1281 </dd>
1282 <dt class="hdlist1">
1283 <tt>git push origin</tt>
1284 </dt>
1285 <dd>
1287 Without additional configuration, works like
1288 <tt>git push origin :</tt>.
1289 </p>
1290 <div class="paragraph"><p>The default behavior of this command when no &lt;refspec&gt; is given can be
1291 configured by setting the <tt>push</tt> option of the remote.</p></div>
1292 <div class="paragraph"><p>For example, to default to pushing only the current branch to <tt>origin</tt>
1293 use <tt>git config remote.origin.push HEAD</tt>. Any valid &lt;refspec&gt; (like
1294 the ones in the examples below) can be configured as the default for
1295 <tt>git push origin</tt>.</p></div>
1296 </dd>
1297 <dt class="hdlist1">
1298 <tt>git push origin :</tt>
1299 </dt>
1300 <dd>
1302 Push "matching" branches to <tt>origin</tt>. See
1303 &lt;refspec&gt; in the <a href="#OPTIONS">OPTIONS</a> section above for a
1304 description of "matching" branches.
1305 </p>
1306 </dd>
1307 <dt class="hdlist1">
1308 <tt>git push origin master</tt>
1309 </dt>
1310 <dd>
1312 Find a ref that matches <tt>master</tt> in the source repository
1313 (most likely, it would find <tt>refs/heads/master</tt>), and update
1314 the same ref (e.g. <tt>refs/heads/master</tt>) in <tt>origin</tt> repository
1315 with it. If <tt>master</tt> did not exist remotely, it would be
1316 created.
1317 </p>
1318 </dd>
1319 <dt class="hdlist1">
1320 <tt>git push origin HEAD</tt>
1321 </dt>
1322 <dd>
1324 A handy way to push the current branch to the same name on the
1325 remote.
1326 </p>
1327 </dd>
1328 <dt class="hdlist1">
1329 <tt>git push origin master:satellite/master dev:satellite/dev</tt>
1330 </dt>
1331 <dd>
1333 Use the source ref that matches <tt>master</tt> (e.g. <tt>refs/heads/master</tt>)
1334 to update the ref that matches <tt>satellite/master</tt> (most probably
1335 <tt>refs/remotes/satellite/master</tt>) in the <tt>origin</tt> repository, then
1336 do the same for <tt>dev</tt> and <tt>satellite/dev</tt>.
1337 </p>
1338 </dd>
1339 <dt class="hdlist1">
1340 <tt>git push origin HEAD:master</tt>
1341 </dt>
1342 <dd>
1344 Push the current branch to the remote ref matching <tt>master</tt> in the
1345 <tt>origin</tt> repository. This form is convenient to push the current
1346 branch without thinking about its local name.
1347 </p>
1348 </dd>
1349 <dt class="hdlist1">
1350 <tt>git push origin master:refs/heads/experimental</tt>
1351 </dt>
1352 <dd>
1354 Create the branch <tt>experimental</tt> in the <tt>origin</tt> repository
1355 by copying the current <tt>master</tt> branch. This form is only
1356 needed to create a new branch or tag in the remote repository when
1357 the local name and the remote name are different; otherwise,
1358 the ref name on its own will work.
1359 </p>
1360 </dd>
1361 <dt class="hdlist1">
1362 <tt>git push origin :experimental</tt>
1363 </dt>
1364 <dd>
1366 Find a ref that matches <tt>experimental</tt> in the <tt>origin</tt> repository
1367 (e.g. <tt>refs/heads/experimental</tt>), and delete it.
1368 </p>
1369 </dd>
1370 <dt class="hdlist1">
1371 <tt>git push origin &#43;dev:master</tt>
1372 </dt>
1373 <dd>
1375 Update the origin repository&#8217;s master branch with the dev branch,
1376 allowing non-fast-forward updates. <strong>This can leave unreferenced
1377 commits dangling in the origin repository.</strong> Consider the
1378 following situation, where a fast-forward is not possible:
1379 </p>
1380 <div class="listingblock">
1381 <div class="content">
1382 <pre><tt> o---o---o---A---B origin/master
1384 X---Y---Z dev</tt></pre>
1385 </div></div>
1386 <div class="paragraph"><p>The above command would change the origin repository to</p></div>
1387 <div class="listingblock">
1388 <div class="content">
1389 <pre><tt> A---B (unnamed branch)
1391 o---o---o---X---Y---Z master</tt></pre>
1392 </div></div>
1393 <div class="paragraph"><p>Commits A and B would no longer belong to a branch with a symbolic name,
1394 and so would be unreachable. As such, these commits would be removed by
1395 a <tt>git gc</tt> command on the origin repository.</p></div>
1396 </dd>
1397 </dl></div>
1398 </div>
1399 <h2 id="_git">GIT</h2>
1400 <div class="sectionbody">
1401 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
1402 </div>
1403 </div>
1404 <div id="footnotes"><hr /></div>
1405 <div id="footer">
1406 <div id="footer-text">
1407 Last updated 2011-09-21 23:01:14 PDT
1408 </div>
1409 </div>
1410 </body>
1411 </html>