Autogenerated HTML docs for v1.7.7-419-g87009
[git/jnareb-git.git] / git-fetch.html
blobe83a44103404ae52cc79b2862c274cd1298913a3
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-fetch(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-fetch(1) Manual Page
574 </h1>
575 <h2>NAME</h2>
576 <div class="sectionbody">
577 <p>git-fetch -
578 Download objects and refs from another repository
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 fetch</em> [&lt;options&gt;] [&lt;repository&gt; [&lt;refspec&gt;&#8230;]]
587 <em>git fetch</em> [&lt;options&gt;] &lt;group&gt;
588 <em>git fetch</em> --multiple [&lt;options&gt;] [(&lt;repository&gt; | &lt;group&gt;)&#8230;]
589 <em>git fetch</em> --all [&lt;options&gt;]</div>
590 <div class="verseblock-attribution">
591 </div></div>
592 </div>
593 <h2 id="_description">DESCRIPTION</h2>
594 <div class="sectionbody">
595 <div class="paragraph"><p>Fetches named heads or tags from one or more other repositories,
596 along with the objects necessary to complete them.</p></div>
597 <div class="paragraph"><p>The ref names and their object names of fetched refs are stored
598 in <tt>.git/FETCH_HEAD</tt>. This information is left for a later merge
599 operation done by <em>git merge</em>.</p></div>
600 <div class="paragraph"><p>When &lt;refspec&gt; stores the fetched result in remote-tracking branches,
601 the tags that point at these branches are automatically
602 followed. This is done by first fetching from the remote using
603 the given &lt;refspec&gt;s, and if the repository has objects that are
604 pointed by remote tags that it does not yet have, then fetch
605 those missing tags. If the other end has tags that point at
606 branches you are not interested in, you will not get them.</p></div>
607 <div class="paragraph"><p><em>git fetch</em> can fetch from either a single named repository,
608 or from several repositories at once if &lt;group&gt; is given and
609 there is a remotes.&lt;group&gt; entry in the configuration file.
610 (See <a href="git-config.html">git-config(1)</a>).</p></div>
611 </div>
612 <h2 id="_options">OPTIONS</h2>
613 <div class="sectionbody">
614 <div class="dlist"><dl>
615 <dt class="hdlist1">
616 --all
617 </dt>
618 <dd>
620 Fetch all remotes.
621 </p>
622 </dd>
623 <dt class="hdlist1">
625 </dt>
626 <dt class="hdlist1">
627 --append
628 </dt>
629 <dd>
631 Append ref names and object names of fetched refs to the
632 existing contents of <tt>.git/FETCH_HEAD</tt>. Without this
633 option old data in <tt>.git/FETCH_HEAD</tt> will be overwritten.
634 </p>
635 </dd>
636 <dt class="hdlist1">
637 --depth=&lt;depth&gt;
638 </dt>
639 <dd>
641 Deepen the history of a <em>shallow</em> repository created by
642 <tt>git clone</tt> with <tt>--depth=&lt;depth&gt;</tt> option (see <a href="git-clone.html">git-clone(1)</a>)
643 by the specified number of commits.
644 </p>
645 </dd>
646 <dt class="hdlist1">
647 --dry-run
648 </dt>
649 <dd>
651 Show what would be done, without making any changes.
652 </p>
653 </dd>
654 <dt class="hdlist1">
656 </dt>
657 <dt class="hdlist1">
658 --force
659 </dt>
660 <dd>
662 When <em>git fetch</em> is used with <tt>&lt;rbranch&gt;:&lt;lbranch&gt;</tt>
663 refspec, it refuses to update the local branch
664 <tt>&lt;lbranch&gt;</tt> unless the remote branch <tt>&lt;rbranch&gt;</tt> it
665 fetches is a descendant of <tt>&lt;lbranch&gt;</tt>. This option
666 overrides that check.
667 </p>
668 </dd>
669 <dt class="hdlist1">
671 </dt>
672 <dt class="hdlist1">
673 --keep
674 </dt>
675 <dd>
677 Keep downloaded pack.
678 </p>
679 </dd>
680 <dt class="hdlist1">
681 --multiple
682 </dt>
683 <dd>
685 Allow several &lt;repository&gt; and &lt;group&gt; arguments to be
686 specified. No &lt;refspec&gt;s may be specified.
687 </p>
688 </dd>
689 <dt class="hdlist1">
691 </dt>
692 <dt class="hdlist1">
693 --prune
694 </dt>
695 <dd>
697 After fetching, remove any remote-tracking branches which
698 no longer exist on the remote.
699 </p>
700 </dd>
701 <dt class="hdlist1">
703 </dt>
704 <dt class="hdlist1">
705 --no-tags
706 </dt>
707 <dd>
709 By default, tags that point at objects that are downloaded
710 from the remote repository are fetched and stored locally.
711 This option disables this automatic tag following. The default
712 behavior for a remote may be specified with the remote.&lt;name&gt;.tagopt
713 setting. See <a href="git-config.html">git-config(1)</a>.
714 </p>
715 </dd>
716 <dt class="hdlist1">
718 </dt>
719 <dt class="hdlist1">
720 --tags
721 </dt>
722 <dd>
724 Most of the tags are fetched automatically as branch
725 heads are downloaded, but tags that do not point at
726 objects reachable from the branch heads that are being
727 tracked will not be fetched by this mechanism. This
728 flag lets all tags and their associated objects be
729 downloaded. The default behavior for a remote may be
730 specified with the remote.&lt;name&gt;.tagopt setting. See
731 <a href="git-config.html">git-config(1)</a>.
732 </p>
733 </dd>
734 <dt class="hdlist1">
735 --recurse-submodules[=yes|on-demand|no]
736 </dt>
737 <dd>
739 This option controls if and under what conditions new commits of
740 populated submodules should be fetched too. It can be used as a
741 boolean option to completely disable recursion when set to <em>no</em> or to
742 unconditionally recurse into all populated submodules when set to
743 <em>yes</em>, which is the default when this option is used without any
744 value. Use <em>on-demand</em> to only recurse into a populated submodule
745 when the superproject retrieves a commit that updates the submodule&#8217;s
746 reference to a commit that isn&#8217;t already in the local submodule
747 clone.
748 </p>
749 </dd>
750 <dt class="hdlist1">
751 --no-recurse-submodules
752 </dt>
753 <dd>
755 Disable recursive fetching of submodules (this has the same effect as
756 using the <em>--recurse-submodules=no</em> option).
757 </p>
758 </dd>
759 <dt class="hdlist1">
760 --submodule-prefix=&lt;path&gt;
761 </dt>
762 <dd>
764 Prepend &lt;path&gt; to paths printed in informative messages
765 such as "Fetching submodule foo". This option is used
766 internally when recursing over submodules.
767 </p>
768 </dd>
769 <dt class="hdlist1">
770 --recurse-submodules-default=[yes|on-demand]
771 </dt>
772 <dd>
774 This option is used internally to temporarily provide a
775 non-negative default value for the --recurse-submodules
776 option. All other methods of configuring fetch&#8217;s submodule
777 recursion (such as settings in <a href="gitmodules.html">gitmodules(5)</a> and
778 <a href="git-config.html">git-config(1)</a>) override this option, as does
779 specifying --[no-]recurse-submodules directly.
780 </p>
781 </dd>
782 <dt class="hdlist1">
784 </dt>
785 <dt class="hdlist1">
786 --update-head-ok
787 </dt>
788 <dd>
790 By default <em>git fetch</em> refuses to update the head which
791 corresponds to the current branch. This flag disables the
792 check. This is purely for the internal use for <em>git pull</em>
793 to communicate with <em>git fetch</em>, and unless you are
794 implementing your own Porcelain you are not supposed to
795 use it.
796 </p>
797 </dd>
798 <dt class="hdlist1">
799 --upload-pack &lt;upload-pack&gt;
800 </dt>
801 <dd>
803 When given, and the repository to fetch from is handled
804 by <em>git fetch-pack</em>, <em>--exec=&lt;upload-pack&gt;</em> is passed to
805 the command to specify non-default path for the command
806 run on the other end.
807 </p>
808 </dd>
809 <dt class="hdlist1">
811 </dt>
812 <dt class="hdlist1">
813 --quiet
814 </dt>
815 <dd>
817 Pass --quiet to git-fetch-pack and silence any other internally
818 used git commands. Progress is not reported to the standard error
819 stream.
820 </p>
821 </dd>
822 <dt class="hdlist1">
824 </dt>
825 <dt class="hdlist1">
826 --verbose
827 </dt>
828 <dd>
830 Be verbose.
831 </p>
832 </dd>
833 <dt class="hdlist1">
834 --progress
835 </dt>
836 <dd>
838 Progress status is reported on the standard error stream
839 by default when it is attached to a terminal, unless -q
840 is specified. This flag forces progress status even if the
841 standard error stream is not directed to a terminal.
842 </p>
843 </dd>
844 <dt class="hdlist1">
845 &lt;repository&gt;
846 </dt>
847 <dd>
849 The "remote" repository that is the source of a fetch
850 or pull operation. This parameter can be either a URL
851 (see the section <a href="#URLS">GIT URLS</a> below) or the name
852 of a remote (see the section <a href="#REMOTES">REMOTES</a> below).
853 </p>
854 </dd>
855 <dt class="hdlist1">
856 &lt;group&gt;
857 </dt>
858 <dd>
860 A name referring to a list of repositories as the value
861 of remotes.&lt;group&gt; in the configuration file.
862 (See <a href="git-config.html">git-config(1)</a>).
863 </p>
864 </dd>
865 <dt class="hdlist1">
866 &lt;refspec&gt;
867 </dt>
868 <dd>
870 The format of a &lt;refspec&gt; parameter is an optional plus
871 <tt>&#43;</tt>, followed by the source ref &lt;src&gt;, followed
872 by a colon <tt>:</tt>, followed by the destination ref &lt;dst&gt;.
873 </p>
874 <div class="paragraph"><p>The remote ref that matches &lt;src&gt;
875 is fetched, and if &lt;dst&gt; is not empty string, the local
876 ref that matches it is fast-forwarded using &lt;src&gt;.
877 If the optional plus <tt>+</tt> is used, the local ref
878 is updated even if it does not result in a fast-forward
879 update.</p></div>
880 <div class="admonitionblock">
881 <table><tr>
882 <td class="icon">
883 <div class="title">Note</div>
884 </td>
885 <td class="content">If the remote branch from which you want to pull is
886 modified in non-linear ways such as being rewound and
887 rebased frequently, then a pull will attempt a merge with
888 an older version of itself, likely conflict, and fail.
889 It is under these conditions that you would want to use
890 the <tt>+</tt> sign to indicate non-fast-forward updates will
891 be needed. There is currently no easy way to determine
892 or declare that a branch will be made available in a
893 repository with this behavior; the pulling user simply
894 must know this is the expected usage pattern for a branch.</td>
895 </tr></table>
896 </div>
897 <div class="admonitionblock">
898 <table><tr>
899 <td class="icon">
900 <div class="title">Note</div>
901 </td>
902 <td class="content">You never do your own development on branches that appear
903 on the right hand side of a &lt;refspec&gt; colon on <tt>Pull:</tt> lines;
904 they are to be updated by <em>git fetch</em>. If you intend to do
905 development derived from a remote branch <tt>B</tt>, have a <tt>Pull:</tt>
906 line to track it (i.e. <tt>Pull: B:remote-B</tt>), and have a separate
907 branch <tt>my-B</tt> to do your development on top of it. The latter
908 is created by <tt>git branch my-B remote-B</tt> (or its equivalent <tt>git
909 checkout -b my-B remote-B</tt>). Run <tt>git fetch</tt> to keep track of
910 the progress of the remote side, and when you see something new
911 on the remote branch, merge it into your development branch with
912 <tt>git pull . remote-B</tt>, while you are on <tt>my-B</tt> branch.</td>
913 </tr></table>
914 </div>
915 <div class="admonitionblock">
916 <table><tr>
917 <td class="icon">
918 <div class="title">Note</div>
919 </td>
920 <td class="content">There is a difference between listing multiple &lt;refspec&gt;
921 directly on <em>git pull</em> command line and having multiple
922 <tt>Pull:</tt> &lt;refspec&gt; lines for a &lt;repository&gt; and running
923 <em>git pull</em> command without any explicit &lt;refspec&gt; parameters.
924 &lt;refspec&gt; listed explicitly on the command line are always
925 merged into the current branch after fetching. In other words,
926 if you list more than one remote refs, you would be making
927 an Octopus. While <em>git pull</em> run without any explicit &lt;refspec&gt;
928 parameter takes default &lt;refspec&gt;s from <tt>Pull:</tt> lines, it
929 merges only the first &lt;refspec&gt; found into the current branch,
930 after fetching all the remote refs. This is because making an
931 Octopus from remote refs is rarely done, while keeping track
932 of multiple remote heads in one-go by fetching more than one
933 is often useful.</td>
934 </tr></table>
935 </div>
936 <div class="paragraph"><p>Some short-cut notations are also supported.</p></div>
937 <div class="ulist"><ul>
938 <li>
940 <tt>tag &lt;tag&gt;</tt> means the same as <tt>refs/tags/&lt;tag&gt;:refs/tags/&lt;tag&gt;</tt>;
941 it requests fetching everything up to the given tag.
942 </p>
943 </li>
944 <li>
946 A parameter &lt;ref&gt; without a colon is equivalent to
947 &lt;ref&gt;: when pulling/fetching, so it merges &lt;ref&gt; into the current
948 branch without storing the remote branch anywhere locally
949 </p>
950 </li>
951 </ul></div>
952 </dd>
953 </dl></div>
954 </div>
955 <h2 id="_git_urls_a_id_urls_a">GIT URLS<a id="URLS"></a></h2>
956 <div class="sectionbody">
957 <div class="paragraph"><p>In general, URLs contain information about the transport protocol, the
958 address of the remote server, and the path to the repository.
959 Depending on the transport protocol, some of this information may be
960 absent.</p></div>
961 <div class="paragraph"><p>Git natively supports ssh, git, http, https, ftp, ftps, and rsync
962 protocols. The following syntaxes may be used with them:</p></div>
963 <div class="ulist"><ul>
964 <li>
966 ssh://&#91;user@&#93;host.xz&#91;:port&#93;/path/to/repo.git/
967 </p>
968 </li>
969 <li>
971 git://host.xz&#91;:port&#93;/path/to/repo.git/
972 </p>
973 </li>
974 <li>
976 http&#91;s&#93;://host.xz&#91;:port&#93;/path/to/repo.git/
977 </p>
978 </li>
979 <li>
981 ftp&#91;s&#93;://host.xz&#91;:port&#93;/path/to/repo.git/
982 </p>
983 </li>
984 <li>
986 rsync://host.xz/path/to/repo.git/
987 </p>
988 </li>
989 </ul></div>
990 <div class="paragraph"><p>An alternative scp-like syntax may also be used with the ssh protocol:</p></div>
991 <div class="ulist"><ul>
992 <li>
994 &#91;user@&#93;host.xz:path/to/repo.git/
995 </p>
996 </li>
997 </ul></div>
998 <div class="paragraph"><p>The ssh and git protocols additionally support ~username expansion:</p></div>
999 <div class="ulist"><ul>
1000 <li>
1002 ssh://&#91;user@&#93;host.xz&#91;:port&#93;/~&#91;user&#93;/path/to/repo.git/
1003 </p>
1004 </li>
1005 <li>
1007 git://host.xz&#91;:port&#93;/~&#91;user&#93;/path/to/repo.git/
1008 </p>
1009 </li>
1010 <li>
1012 &#91;user@&#93;host.xz:/~&#91;user&#93;/path/to/repo.git/
1013 </p>
1014 </li>
1015 </ul></div>
1016 <div class="paragraph"><p>For local repositories, also supported by git natively, the following
1017 syntaxes may be used:</p></div>
1018 <div class="ulist"><ul>
1019 <li>
1021 /path/to/repo.git/
1022 </p>
1023 </li>
1024 <li>
1026 <a href="file:///path/to/repo.git/">file:///path/to/repo.git/</a>
1027 </p>
1028 </li>
1029 </ul></div>
1030 <div class="paragraph"><p>These two syntaxes are mostly equivalent, except when cloning, when
1031 the former implies --local option. See <a href="git-clone.html">git-clone(1)</a> for
1032 details.</p></div>
1033 <div class="paragraph"><p>When git doesn&#8217;t know how to handle a certain transport protocol, it
1034 attempts to use the <em>remote-&lt;transport&gt;</em> remote helper, if one
1035 exists. To explicitly request a remote helper, the following syntax
1036 may be used:</p></div>
1037 <div class="ulist"><ul>
1038 <li>
1040 &lt;transport&gt;::&lt;address&gt;
1041 </p>
1042 </li>
1043 </ul></div>
1044 <div class="paragraph"><p>where &lt;address&gt; may be a path, a server and path, or an arbitrary
1045 URL-like string recognized by the specific remote helper being
1046 invoked. See <a href="git-remote-helpers.html">git-remote-helpers(1)</a> for details.</p></div>
1047 <div class="paragraph"><p>If there are a large number of similarly-named remote repositories and
1048 you want to use a different format for them (such that the URLs you
1049 use will be rewritten into URLs that work), you can create a
1050 configuration section of the form:</p></div>
1051 <div class="listingblock">
1052 <div class="content">
1053 <pre><tt> [url "&lt;actual url base&gt;"]
1054 insteadOf = &lt;other url base&gt;</tt></pre>
1055 </div></div>
1056 <div class="paragraph"><p>For example, with this:</p></div>
1057 <div class="listingblock">
1058 <div class="content">
1059 <pre><tt> [url "git://git.host.xz/"]
1060 insteadOf = host.xz:/path/to/
1061 insteadOf = work:</tt></pre>
1062 </div></div>
1063 <div class="paragraph"><p>a URL like "work:repo.git" or like "host.xz:/path/to/repo.git" will be
1064 rewritten in any context that takes a URL to be "git://git.host.xz/repo.git".</p></div>
1065 <div class="paragraph"><p>If you want to rewrite URLs for push only, you can create a
1066 configuration section of the form:</p></div>
1067 <div class="listingblock">
1068 <div class="content">
1069 <pre><tt> [url "&lt;actual url base&gt;"]
1070 pushInsteadOf = &lt;other url base&gt;</tt></pre>
1071 </div></div>
1072 <div class="paragraph"><p>For example, with this:</p></div>
1073 <div class="listingblock">
1074 <div class="content">
1075 <pre><tt> [url "ssh://example.org/"]
1076 pushInsteadOf = git://example.org/</tt></pre>
1077 </div></div>
1078 <div class="paragraph"><p>a URL like "git://example.org/path/to/repo.git" will be rewritten to
1079 "ssh://example.org/path/to/repo.git" for pushes, but pulls will still
1080 use the original URL.</p></div>
1081 </div>
1082 <h2 id="_remotes_a_id_remotes_a">REMOTES<a id="REMOTES"></a></h2>
1083 <div class="sectionbody">
1084 <div class="paragraph"><p>The name of one of the following can be used instead
1085 of a URL as <tt>&lt;repository&gt;</tt> argument:</p></div>
1086 <div class="ulist"><ul>
1087 <li>
1089 a remote in the git configuration file: <tt>$GIT_DIR/config</tt>,
1090 </p>
1091 </li>
1092 <li>
1094 a file in the <tt>$GIT_DIR/remotes</tt> directory, or
1095 </p>
1096 </li>
1097 <li>
1099 a file in the <tt>$GIT_DIR/branches</tt> directory.
1100 </p>
1101 </li>
1102 </ul></div>
1103 <div class="paragraph"><p>All of these also allow you to omit the refspec from the command line
1104 because they each contain a refspec which git will use by default.</p></div>
1105 <h3 id="_named_remote_in_configuration_file">Named remote in configuration file</h3><div style="clear:left"></div>
1106 <div class="paragraph"><p>You can choose to provide the name of a remote which you had previously
1107 configured using <a href="git-remote.html">git-remote(1)</a>, <a href="git-config.html">git-config(1)</a>
1108 or even by a manual edit to the <tt>$GIT_DIR/config</tt> file. The URL of
1109 this remote will be used to access the repository. The refspec
1110 of this remote will be used by default when you do
1111 not provide a refspec on the command line. The entry in the
1112 config file would appear like this:</p></div>
1113 <div class="listingblock">
1114 <div class="content">
1115 <pre><tt> [remote "&lt;name&gt;"]
1116 url = &lt;url&gt;
1117 pushurl = &lt;pushurl&gt;
1118 push = &lt;refspec&gt;
1119 fetch = &lt;refspec&gt;</tt></pre>
1120 </div></div>
1121 <div class="paragraph"><p>The <tt>&lt;pushurl&gt;</tt> is used for pushes only. It is optional and defaults
1122 to <tt>&lt;url&gt;</tt>.</p></div>
1123 <h3 id="_named_file_in_tt_git_dir_remotes_tt">Named file in <tt>$GIT_DIR/remotes</tt></h3><div style="clear:left"></div>
1124 <div class="paragraph"><p>You can choose to provide the name of a
1125 file in <tt>$GIT_DIR/remotes</tt>. The URL
1126 in this file will be used to access the repository. The refspec
1127 in this file will be used as default when you do not
1128 provide a refspec on the command line. This file should have the
1129 following format:</p></div>
1130 <div class="listingblock">
1131 <div class="content">
1132 <pre><tt> URL: one of the above URL format
1133 Push: &lt;refspec&gt;
1134 Pull: &lt;refspec&gt;</tt></pre>
1135 </div></div>
1136 <div class="paragraph"><p><tt>Push:</tt> lines are used by <em>git push</em> and
1137 <tt>Pull:</tt> lines are used by <em>git pull</em> and <em>git fetch</em>.
1138 Multiple <tt>Push:</tt> and <tt>Pull:</tt> lines may
1139 be specified for additional branch mappings.</p></div>
1140 <h3 id="_named_file_in_tt_git_dir_branches_tt">Named file in <tt>$GIT_DIR/branches</tt></h3><div style="clear:left"></div>
1141 <div class="paragraph"><p>You can choose to provide the name of a
1142 file in <tt>$GIT_DIR/branches</tt>.
1143 The URL in this file will be used to access the repository.
1144 This file should have the following format:</p></div>
1145 <div class="listingblock">
1146 <div class="content">
1147 <pre><tt> &lt;url&gt;#&lt;head&gt;</tt></pre>
1148 </div></div>
1149 <div class="paragraph"><p><tt>&lt;url&gt;</tt> is required; <tt>#&lt;head&gt;</tt> is optional.</p></div>
1150 <div class="paragraph"><p>Depending on the operation, git will use one of the following
1151 refspecs, if you don&#8217;t provide one on the command line.
1152 <tt>&lt;branch&gt;</tt> is the name of this file in <tt>$GIT_DIR/branches</tt> and
1153 <tt>&lt;head&gt;</tt> defaults to <tt>master</tt>.</p></div>
1154 <div class="paragraph"><p>git fetch uses:</p></div>
1155 <div class="listingblock">
1156 <div class="content">
1157 <pre><tt> refs/heads/&lt;head&gt;:refs/heads/&lt;branch&gt;</tt></pre>
1158 </div></div>
1159 <div class="paragraph"><p>git push uses:</p></div>
1160 <div class="listingblock">
1161 <div class="content">
1162 <pre><tt> HEAD:refs/heads/&lt;head&gt;</tt></pre>
1163 </div></div>
1164 </div>
1165 <h2 id="_examples">EXAMPLES</h2>
1166 <div class="sectionbody">
1167 <div class="ulist"><ul>
1168 <li>
1170 Update the remote-tracking branches:
1171 </p>
1172 <div class="listingblock">
1173 <div class="content">
1174 <pre><tt>$ git fetch origin</tt></pre>
1175 </div></div>
1176 <div class="paragraph"><p>The above command copies all branches from the remote refs/heads/
1177 namespace and stores them to the local refs/remotes/origin/ namespace,
1178 unless the branch.&lt;name&gt;.fetch option is used to specify a non-default
1179 refspec.</p></div>
1180 </li>
1181 <li>
1183 Using refspecs explicitly:
1184 </p>
1185 <div class="listingblock">
1186 <div class="content">
1187 <pre><tt>$ git fetch origin +pu:pu maint:tmp</tt></pre>
1188 </div></div>
1189 <div class="paragraph"><p>This updates (or creates, as necessary) branches <tt>pu</tt> and <tt>tmp</tt> in
1190 the local repository by fetching from the branches (respectively)
1191 <tt>pu</tt> and <tt>maint</tt> from the remote repository.</p></div>
1192 <div class="paragraph"><p>The <tt>pu</tt> branch will be updated even if it is does not fast-forward,
1193 because it is prefixed with a plus sign; <tt>tmp</tt> will not be.</p></div>
1194 </li>
1195 </ul></div>
1196 </div>
1197 <h2 id="_bugs">BUGS</h2>
1198 <div class="sectionbody">
1199 <div class="paragraph"><p>Using --recurse-submodules can only fetch new commits in already checked
1200 out submodules right now. When e.g. upstream added a new submodule in the
1201 just fetched commits of the superproject the submodule itself can not be
1202 fetched, making it impossible to check out that submodule later without
1203 having to do a fetch again. This is expected to be fixed in a future git
1204 version.</p></div>
1205 </div>
1206 <h2 id="_see_also">SEE ALSO</h2>
1207 <div class="sectionbody">
1208 <div class="paragraph"><p><a href="git-pull.html">git-pull(1)</a></p></div>
1209 </div>
1210 <h2 id="_git">GIT</h2>
1211 <div class="sectionbody">
1212 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
1213 </div>
1214 </div>
1215 <div id="footnotes"><hr /></div>
1216 <div id="footer">
1217 <div id="footer-text">
1218 Last updated 2011-09-21 23:01:14 PDT
1219 </div>
1220 </div>
1221 </body>
1222 </html>