Autogenerated HTML docs for v2.45.1-204-gd8ab1
[git-htmldocs.git] / git-fetch.html
blob6ee6a26e79ac781099fdf2706936621bee660250
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
4 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
5 <head>
6 <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
7 <meta name="generator" content="AsciiDoc 10.2.0" />
8 <title>git-fetch(1)</title>
9 <style type="text/css">
10 /* Shared CSS for AsciiDoc xhtml11 and html5 backends */
12 /* Default font. */
13 body {
14 font-family: Georgia,serif;
17 /* Title font. */
18 h1, h2, h3, h4, h5, h6,
19 div.title, caption.title,
20 thead, p.table.header,
21 #toctitle,
22 #author, #revnumber, #revdate, #revremark,
23 #footer {
24 font-family: Arial,Helvetica,sans-serif;
27 body {
28 margin: 1em 5% 1em 5%;
31 a {
32 color: blue;
33 text-decoration: underline;
35 a:visited {
36 color: fuchsia;
39 em {
40 font-style: italic;
41 color: navy;
44 strong {
45 font-weight: bold;
46 color: #083194;
49 h1, h2, h3, h4, h5, h6 {
50 color: #527bbd;
51 margin-top: 1.2em;
52 margin-bottom: 0.5em;
53 line-height: 1.3;
56 h1, h2, h3 {
57 border-bottom: 2px solid silver;
59 h2 {
60 padding-top: 0.5em;
62 h3 {
63 float: left;
65 h3 + * {
66 clear: left;
68 h5 {
69 font-size: 1.0em;
72 div.sectionbody {
73 margin-left: 0;
76 hr {
77 border: 1px solid silver;
80 p {
81 margin-top: 0.5em;
82 margin-bottom: 0.5em;
85 ul, ol, li > p {
86 margin-top: 0;
88 ul > li { color: #aaa; }
89 ul > li > * { color: black; }
91 .monospaced, code, pre {
92 font-family: "Courier New", Courier, monospace;
93 font-size: inherit;
94 color: navy;
95 padding: 0;
96 margin: 0;
98 pre {
99 white-space: pre-wrap;
102 #author {
103 color: #527bbd;
104 font-weight: bold;
105 font-size: 1.1em;
107 #email {
109 #revnumber, #revdate, #revremark {
112 #footer {
113 font-size: small;
114 border-top: 2px solid silver;
115 padding-top: 0.5em;
116 margin-top: 4.0em;
118 #footer-text {
119 float: left;
120 padding-bottom: 0.5em;
122 #footer-badges {
123 float: right;
124 padding-bottom: 0.5em;
127 #preamble {
128 margin-top: 1.5em;
129 margin-bottom: 1.5em;
131 div.imageblock, div.exampleblock, div.verseblock,
132 div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
133 div.admonitionblock {
134 margin-top: 1.0em;
135 margin-bottom: 1.5em;
137 div.admonitionblock {
138 margin-top: 2.0em;
139 margin-bottom: 2.0em;
140 margin-right: 10%;
141 color: #606060;
144 div.content { /* Block element content. */
145 padding: 0;
148 /* Block element titles. */
149 div.title, caption.title {
150 color: #527bbd;
151 font-weight: bold;
152 text-align: left;
153 margin-top: 1.0em;
154 margin-bottom: 0.5em;
156 div.title + * {
157 margin-top: 0;
160 td div.title:first-child {
161 margin-top: 0.0em;
163 div.content div.title:first-child {
164 margin-top: 0.0em;
166 div.content + div.title {
167 margin-top: 0.0em;
170 div.sidebarblock > div.content {
171 background: #ffffee;
172 border: 1px solid #dddddd;
173 border-left: 4px solid #f0f0f0;
174 padding: 0.5em;
177 div.listingblock > div.content {
178 border: 1px solid #dddddd;
179 border-left: 5px solid #f0f0f0;
180 background: #f8f8f8;
181 padding: 0.5em;
184 div.quoteblock, div.verseblock {
185 padding-left: 1.0em;
186 margin-left: 1.0em;
187 margin-right: 10%;
188 border-left: 5px solid #f0f0f0;
189 color: #888;
192 div.quoteblock > div.attribution {
193 padding-top: 0.5em;
194 text-align: right;
197 div.verseblock > pre.content {
198 font-family: inherit;
199 font-size: inherit;
201 div.verseblock > div.attribution {
202 padding-top: 0.75em;
203 text-align: left;
205 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
206 div.verseblock + div.attribution {
207 text-align: left;
210 div.admonitionblock .icon {
211 vertical-align: top;
212 font-size: 1.1em;
213 font-weight: bold;
214 text-decoration: underline;
215 color: #527bbd;
216 padding-right: 0.5em;
218 div.admonitionblock td.content {
219 padding-left: 0.5em;
220 border-left: 3px solid #dddddd;
223 div.exampleblock > div.content {
224 border-left: 3px solid #dddddd;
225 padding-left: 0.5em;
228 div.imageblock div.content { padding-left: 0; }
229 span.image img { border-style: none; vertical-align: text-bottom; }
230 a.image:visited { color: white; }
232 dl {
233 margin-top: 0.8em;
234 margin-bottom: 0.8em;
236 dt {
237 margin-top: 0.5em;
238 margin-bottom: 0;
239 font-style: normal;
240 color: navy;
242 dd > *:first-child {
243 margin-top: 0.1em;
246 ul, ol {
247 list-style-position: outside;
249 ol.arabic {
250 list-style-type: decimal;
252 ol.loweralpha {
253 list-style-type: lower-alpha;
255 ol.upperalpha {
256 list-style-type: upper-alpha;
258 ol.lowerroman {
259 list-style-type: lower-roman;
261 ol.upperroman {
262 list-style-type: upper-roman;
265 div.compact ul, div.compact ol,
266 div.compact p, div.compact p,
267 div.compact div, div.compact div {
268 margin-top: 0.1em;
269 margin-bottom: 0.1em;
272 tfoot {
273 font-weight: bold;
275 td > div.verse {
276 white-space: pre;
279 div.hdlist {
280 margin-top: 0.8em;
281 margin-bottom: 0.8em;
283 div.hdlist tr {
284 padding-bottom: 15px;
286 dt.hdlist1.strong, td.hdlist1.strong {
287 font-weight: bold;
289 td.hdlist1 {
290 vertical-align: top;
291 font-style: normal;
292 padding-right: 0.8em;
293 color: navy;
295 td.hdlist2 {
296 vertical-align: top;
298 div.hdlist.compact tr {
299 margin: 0;
300 padding-bottom: 0;
303 .comment {
304 background: yellow;
307 .footnote, .footnoteref {
308 font-size: 0.8em;
311 span.footnote, span.footnoteref {
312 vertical-align: super;
315 #footnotes {
316 margin: 20px 0 20px 0;
317 padding: 7px 0 0 0;
320 #footnotes div.footnote {
321 margin: 0 0 5px 0;
324 #footnotes hr {
325 border: none;
326 border-top: 1px solid silver;
327 height: 1px;
328 text-align: left;
329 margin-left: 0;
330 width: 20%;
331 min-width: 100px;
334 div.colist td {
335 padding-right: 0.5em;
336 padding-bottom: 0.3em;
337 vertical-align: top;
339 div.colist td img {
340 margin-top: 0.3em;
343 @media print {
344 #footer-badges { display: none; }
347 #toc {
348 margin-bottom: 2.5em;
351 #toctitle {
352 color: #527bbd;
353 font-size: 1.1em;
354 font-weight: bold;
355 margin-top: 1.0em;
356 margin-bottom: 0.1em;
359 div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
360 margin-top: 0;
361 margin-bottom: 0;
363 div.toclevel2 {
364 margin-left: 2em;
365 font-size: 0.9em;
367 div.toclevel3 {
368 margin-left: 4em;
369 font-size: 0.9em;
371 div.toclevel4 {
372 margin-left: 6em;
373 font-size: 0.9em;
376 span.aqua { color: aqua; }
377 span.black { color: black; }
378 span.blue { color: blue; }
379 span.fuchsia { color: fuchsia; }
380 span.gray { color: gray; }
381 span.green { color: green; }
382 span.lime { color: lime; }
383 span.maroon { color: maroon; }
384 span.navy { color: navy; }
385 span.olive { color: olive; }
386 span.purple { color: purple; }
387 span.red { color: red; }
388 span.silver { color: silver; }
389 span.teal { color: teal; }
390 span.white { color: white; }
391 span.yellow { color: yellow; }
393 span.aqua-background { background: aqua; }
394 span.black-background { background: black; }
395 span.blue-background { background: blue; }
396 span.fuchsia-background { background: fuchsia; }
397 span.gray-background { background: gray; }
398 span.green-background { background: green; }
399 span.lime-background { background: lime; }
400 span.maroon-background { background: maroon; }
401 span.navy-background { background: navy; }
402 span.olive-background { background: olive; }
403 span.purple-background { background: purple; }
404 span.red-background { background: red; }
405 span.silver-background { background: silver; }
406 span.teal-background { background: teal; }
407 span.white-background { background: white; }
408 span.yellow-background { background: yellow; }
410 span.big { font-size: 2em; }
411 span.small { font-size: 0.6em; }
413 span.underline { text-decoration: underline; }
414 span.overline { text-decoration: overline; }
415 span.line-through { text-decoration: line-through; }
417 div.unbreakable { page-break-inside: avoid; }
421 * xhtml11 specific
423 * */
425 div.tableblock {
426 margin-top: 1.0em;
427 margin-bottom: 1.5em;
429 div.tableblock > table {
430 border: 3px solid #527bbd;
432 thead, p.table.header {
433 font-weight: bold;
434 color: #527bbd;
436 p.table {
437 margin-top: 0;
439 /* Because the table frame attribute is overridden by CSS in most browsers. */
440 div.tableblock > table[frame="void"] {
441 border-style: none;
443 div.tableblock > table[frame="hsides"] {
444 border-left-style: none;
445 border-right-style: none;
447 div.tableblock > table[frame="vsides"] {
448 border-top-style: none;
449 border-bottom-style: none;
454 * html5 specific
456 * */
458 table.tableblock {
459 margin-top: 1.0em;
460 margin-bottom: 1.5em;
462 thead, p.tableblock.header {
463 font-weight: bold;
464 color: #527bbd;
466 p.tableblock {
467 margin-top: 0;
469 table.tableblock {
470 border-width: 3px;
471 border-spacing: 0px;
472 border-style: solid;
473 border-color: #527bbd;
474 border-collapse: collapse;
476 th.tableblock, td.tableblock {
477 border-width: 1px;
478 padding: 4px;
479 border-style: solid;
480 border-color: #527bbd;
483 table.tableblock.frame-topbot {
484 border-left-style: hidden;
485 border-right-style: hidden;
487 table.tableblock.frame-sides {
488 border-top-style: hidden;
489 border-bottom-style: hidden;
491 table.tableblock.frame-none {
492 border-style: hidden;
495 th.tableblock.halign-left, td.tableblock.halign-left {
496 text-align: left;
498 th.tableblock.halign-center, td.tableblock.halign-center {
499 text-align: center;
501 th.tableblock.halign-right, td.tableblock.halign-right {
502 text-align: right;
505 th.tableblock.valign-top, td.tableblock.valign-top {
506 vertical-align: top;
508 th.tableblock.valign-middle, td.tableblock.valign-middle {
509 vertical-align: middle;
511 th.tableblock.valign-bottom, td.tableblock.valign-bottom {
512 vertical-align: bottom;
517 * manpage specific
519 * */
521 body.manpage h1 {
522 padding-top: 0.5em;
523 padding-bottom: 0.5em;
524 border-top: 2px solid silver;
525 border-bottom: 2px solid silver;
527 body.manpage h2 {
528 border-style: none;
530 body.manpage div.sectionbody {
531 margin-left: 3em;
534 @media print {
535 body.manpage div#toc { display: none; }
539 </style>
540 <script type="text/javascript">
541 /*<![CDATA[*/
542 var asciidoc = { // Namespace.
544 /////////////////////////////////////////////////////////////////////
545 // Table Of Contents generator
546 /////////////////////////////////////////////////////////////////////
548 /* Author: Mihai Bazon, September 2002
549 * http://students.infoiasi.ro/~mishoo
551 * Table Of Content generator
552 * Version: 0.4
554 * Feel free to use this script under the terms of the GNU General Public
555 * License, as long as you do not remove or alter this notice.
558 /* modified by Troy D. Hanson, September 2006. License: GPL */
559 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
561 // toclevels = 1..4.
562 toc: function (toclevels) {
564 function getText(el) {
565 var text = "";
566 for (var i = el.firstChild; i != null; i = i.nextSibling) {
567 if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
568 text += i.data;
569 else if (i.firstChild != null)
570 text += getText(i);
572 return text;
575 function TocEntry(el, text, toclevel) {
576 this.element = el;
577 this.text = text;
578 this.toclevel = toclevel;
581 function tocEntries(el, toclevels) {
582 var result = new Array;
583 var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
584 // Function that scans the DOM tree for header elements (the DOM2
585 // nodeIterator API would be a better technique but not supported by all
586 // browsers).
587 var iterate = function (el) {
588 for (var i = el.firstChild; i != null; i = i.nextSibling) {
589 if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
590 var mo = re.exec(i.tagName);
591 if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
592 result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
594 iterate(i);
598 iterate(el);
599 return result;
602 var toc = document.getElementById("toc");
603 if (!toc) {
604 return;
607 // Delete existing TOC entries in case we're reloading the TOC.
608 var tocEntriesToRemove = [];
609 var i;
610 for (i = 0; i < toc.childNodes.length; i++) {
611 var entry = toc.childNodes[i];
612 if (entry.nodeName.toLowerCase() == 'div'
613 && entry.getAttribute("class")
614 && entry.getAttribute("class").match(/^toclevel/))
615 tocEntriesToRemove.push(entry);
617 for (i = 0; i < tocEntriesToRemove.length; i++) {
618 toc.removeChild(tocEntriesToRemove[i]);
621 // Rebuild TOC entries.
622 var entries = tocEntries(document.getElementById("content"), toclevels);
623 for (var i = 0; i < entries.length; ++i) {
624 var entry = entries[i];
625 if (entry.element.id == "")
626 entry.element.id = "_toc_" + i;
627 var a = document.createElement("a");
628 a.href = "#" + entry.element.id;
629 a.appendChild(document.createTextNode(entry.text));
630 var div = document.createElement("div");
631 div.appendChild(a);
632 div.className = "toclevel" + entry.toclevel;
633 toc.appendChild(div);
635 if (entries.length == 0)
636 toc.parentNode.removeChild(toc);
640 /////////////////////////////////////////////////////////////////////
641 // Footnotes generator
642 /////////////////////////////////////////////////////////////////////
644 /* Based on footnote generation code from:
645 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
648 footnotes: function () {
649 // Delete existing footnote entries in case we're reloading the footnodes.
650 var i;
651 var noteholder = document.getElementById("footnotes");
652 if (!noteholder) {
653 return;
655 var entriesToRemove = [];
656 for (i = 0; i < noteholder.childNodes.length; i++) {
657 var entry = noteholder.childNodes[i];
658 if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
659 entriesToRemove.push(entry);
661 for (i = 0; i < entriesToRemove.length; i++) {
662 noteholder.removeChild(entriesToRemove[i]);
665 // Rebuild footnote entries.
666 var cont = document.getElementById("content");
667 var spans = cont.getElementsByTagName("span");
668 var refs = {};
669 var n = 0;
670 for (i=0; i<spans.length; i++) {
671 if (spans[i].className == "footnote") {
672 n++;
673 var note = spans[i].getAttribute("data-note");
674 if (!note) {
675 // Use [\s\S] in place of . so multi-line matches work.
676 // Because JavaScript has no s (dotall) regex flag.
677 note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
678 spans[i].innerHTML =
679 "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
680 "' title='View footnote' class='footnote'>" + n + "</a>]";
681 spans[i].setAttribute("data-note", note);
683 noteholder.innerHTML +=
684 "<div class='footnote' id='_footnote_" + n + "'>" +
685 "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
686 n + "</a>. " + note + "</div>";
687 var id =spans[i].getAttribute("id");
688 if (id != null) refs["#"+id] = n;
691 if (n == 0)
692 noteholder.parentNode.removeChild(noteholder);
693 else {
694 // Process footnoterefs.
695 for (i=0; i<spans.length; i++) {
696 if (spans[i].className == "footnoteref") {
697 var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
698 href = href.match(/#.*/)[0]; // Because IE return full URL.
699 n = refs[href];
700 spans[i].innerHTML =
701 "[<a href='#_footnote_" + n +
702 "' title='View footnote' class='footnote'>" + n + "</a>]";
708 install: function(toclevels) {
709 var timerId;
711 function reinstall() {
712 asciidoc.footnotes();
713 if (toclevels) {
714 asciidoc.toc(toclevels);
718 function reinstallAndRemoveTimer() {
719 clearInterval(timerId);
720 reinstall();
723 timerId = setInterval(reinstall, 500);
724 if (document.addEventListener)
725 document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
726 else
727 window.onload = reinstallAndRemoveTimer;
731 asciidoc.install();
732 /*]]>*/
733 </script>
734 </head>
735 <body class="manpage">
736 <div id="header">
737 <h1>
738 git-fetch(1) Manual Page
739 </h1>
740 <h2>NAME</h2>
741 <div class="sectionbody">
742 <p>git-fetch -
743 Download objects and refs from another repository
744 </p>
745 </div>
746 </div>
747 <div id="content">
748 <div class="sect1">
749 <h2 id="_synopsis">SYNOPSIS</h2>
750 <div class="sectionbody">
751 <div class="verseblock">
752 <pre class="content"><em>git fetch</em> [&lt;options&gt;] [&lt;repository&gt; [&lt;refspec&gt;&#8230;]]
753 <em>git fetch</em> [&lt;options&gt;] &lt;group&gt;
754 <em>git fetch</em> --multiple [&lt;options&gt;] [(&lt;repository&gt; | &lt;group&gt;)&#8230;]
755 <em>git fetch</em> --all [&lt;options&gt;]</pre>
756 <div class="attribution">
757 </div></div>
758 </div>
759 </div>
760 <div class="sect1">
761 <h2 id="_description">DESCRIPTION</h2>
762 <div class="sectionbody">
763 <div class="paragraph"><p>Fetch branches and/or tags (collectively, "refs") from one or more
764 other repositories, along with the objects necessary to complete their
765 histories. Remote-tracking branches are updated (see the description
766 of &lt;refspec&gt; below for ways to control this behavior).</p></div>
767 <div class="paragraph"><p>By default, any tag that points into the histories being fetched is
768 also fetched; the effect is to fetch tags that
769 point at branches that you are interested in. This default behavior
770 can be changed by using the --tags or --no-tags options or by
771 configuring remote.&lt;name&gt;.tagOpt. By using a refspec that fetches tags
772 explicitly, you can fetch tags that do not point into branches you
773 are interested in as well.</p></div>
774 <div class="paragraph"><p><em>git fetch</em> can fetch from either a single named repository or URL,
775 or from several repositories at once if &lt;group&gt; is given and
776 there is a remotes.&lt;group&gt; entry in the configuration file.
777 (See <a href="git-config.html">git-config(1)</a>).</p></div>
778 <div class="paragraph"><p>When no remote is specified, by default the <code>origin</code> remote will be used,
779 unless there&#8217;s an upstream branch configured for the current branch.</p></div>
780 <div class="paragraph"><p>The names of refs that are fetched, together with the object names
781 they point at, are written to <code>.git/FETCH_HEAD</code>. This information
782 may be used by scripts or other git commands, such as <a href="git-pull.html">git-pull(1)</a>.</p></div>
783 </div>
784 </div>
785 <div class="sect1">
786 <h2 id="_options">OPTIONS</h2>
787 <div class="sectionbody">
788 <div class="dlist"><dl>
789 <dt class="hdlist1">
790 --[no-]all
791 </dt>
792 <dd>
794 Fetch all remotes. This overrides the configuration variable
795 <code>fetch.all</code>.
796 </p>
797 </dd>
798 <dt class="hdlist1">
800 </dt>
801 <dt class="hdlist1">
802 --append
803 </dt>
804 <dd>
806 Append ref names and object names of fetched refs to the
807 existing contents of <code>.git/FETCH_HEAD</code>. Without this
808 option old data in <code>.git/FETCH_HEAD</code> will be overwritten.
809 </p>
810 </dd>
811 <dt class="hdlist1">
812 --atomic
813 </dt>
814 <dd>
816 Use an atomic transaction to update local refs. Either all refs are
817 updated, or on error, no refs are updated.
818 </p>
819 </dd>
820 <dt class="hdlist1">
821 --depth=&lt;depth&gt;
822 </dt>
823 <dd>
825 Limit fetching to the specified number of commits from the tip of
826 each remote branch history. If fetching to a <em>shallow</em> repository
827 created by <code>git clone</code> with <code>--depth=&lt;depth&gt;</code> option (see
828 <a href="git-clone.html">git-clone(1)</a>), deepen or shorten the history to the specified
829 number of commits. Tags for the deepened commits are not fetched.
830 </p>
831 </dd>
832 <dt class="hdlist1">
833 --deepen=&lt;depth&gt;
834 </dt>
835 <dd>
837 Similar to --depth, except it specifies the number of commits
838 from the current shallow boundary instead of from the tip of
839 each remote branch history.
840 </p>
841 </dd>
842 <dt class="hdlist1">
843 --shallow-since=&lt;date&gt;
844 </dt>
845 <dd>
847 Deepen or shorten the history of a shallow repository to
848 include all reachable commits after &lt;date&gt;.
849 </p>
850 </dd>
851 <dt class="hdlist1">
852 --shallow-exclude=&lt;revision&gt;
853 </dt>
854 <dd>
856 Deepen or shorten the history of a shallow repository to
857 exclude commits reachable from a specified remote branch or tag.
858 This option can be specified multiple times.
859 </p>
860 </dd>
861 <dt class="hdlist1">
862 --unshallow
863 </dt>
864 <dd>
866 If the source repository is complete, convert a shallow
867 repository to a complete one, removing all the limitations
868 imposed by shallow repositories.
869 </p>
870 <div class="paragraph"><p>If the source repository is shallow, fetch as much as possible so that
871 the current repository has the same history as the source repository.</p></div>
872 </dd>
873 <dt class="hdlist1">
874 --update-shallow
875 </dt>
876 <dd>
878 By default when fetching from a shallow repository,
879 <code>git fetch</code> refuses refs that require updating
880 .git/shallow. This option updates .git/shallow and accepts such
881 refs.
882 </p>
883 </dd>
884 <dt class="hdlist1">
885 --negotiation-tip=&lt;commit|glob&gt;
886 </dt>
887 <dd>
889 By default, Git will report, to the server, commits reachable
890 from all local refs to find common commits in an attempt to
891 reduce the size of the to-be-received packfile. If specified,
892 Git will only report commits reachable from the given tips.
893 This is useful to speed up fetches when the user knows which
894 local ref is likely to have commits in common with the
895 upstream ref being fetched.
896 </p>
897 <div class="paragraph"><p>This option may be specified more than once; if so, Git will report
898 commits reachable from any of the given commits.</p></div>
899 <div class="paragraph"><p>The argument to this option may be a glob on ref names, a ref, or the (possibly
900 abbreviated) SHA-1 of a commit. Specifying a glob is equivalent to specifying
901 this option multiple times, one for each matching ref name.</p></div>
902 <div class="paragraph"><p>See also the <code>fetch.negotiationAlgorithm</code> and <code>push.negotiate</code>
903 configuration variables documented in <a href="git-config.html">git-config(1)</a>, and the
904 <code>--negotiate-only</code> option below.</p></div>
905 </dd>
906 <dt class="hdlist1">
907 --negotiate-only
908 </dt>
909 <dd>
911 Do not fetch anything from the server, and instead print the
912 ancestors of the provided <code>--negotiation-tip=*</code> arguments,
913 which we have in common with the server.
914 </p>
915 <div class="paragraph"><p>This is incompatible with <code>--recurse-submodules=[yes|on-demand]</code>.
916 Internally this is used to implement the <code>push.negotiate</code> option, see
917 <a href="git-config.html">git-config(1)</a>.</p></div>
918 </dd>
919 <dt class="hdlist1">
920 --dry-run
921 </dt>
922 <dd>
924 Show what would be done, without making any changes.
925 </p>
926 </dd>
927 <dt class="hdlist1">
928 --porcelain
929 </dt>
930 <dd>
932 Print the output to standard output in an easy-to-parse format for
933 scripts. See section OUTPUT in <a href="git-fetch.html">git-fetch(1)</a> for details.
934 </p>
935 <div class="paragraph"><p>This is incompatible with <code>--recurse-submodules=[yes|on-demand]</code> and takes
936 precedence over the <code>fetch.output</code> config option.</p></div>
937 </dd>
938 <dt class="hdlist1">
939 --[no-]write-fetch-head
940 </dt>
941 <dd>
943 Write the list of remote refs fetched in the <code>FETCH_HEAD</code>
944 file directly under <code>$GIT_DIR</code>. This is the default.
945 Passing <code>--no-write-fetch-head</code> from the command line tells
946 Git not to write the file. Under <code>--dry-run</code> option, the
947 file is never written.
948 </p>
949 </dd>
950 <dt class="hdlist1">
952 </dt>
953 <dt class="hdlist1">
954 --force
955 </dt>
956 <dd>
958 When <em>git fetch</em> is used with <code>&lt;src&gt;:&lt;dst&gt;</code> refspec, it may
959 refuse to update the local branch as discussed
960 in the <code>&lt;refspec&gt;</code> part below.
961 This option overrides that check.
962 </p>
963 </dd>
964 <dt class="hdlist1">
966 </dt>
967 <dt class="hdlist1">
968 --keep
969 </dt>
970 <dd>
972 Keep downloaded pack.
973 </p>
974 </dd>
975 <dt class="hdlist1">
976 --multiple
977 </dt>
978 <dd>
980 Allow several &lt;repository&gt; and &lt;group&gt; arguments to be
981 specified. No &lt;refspec&gt;s may be specified.
982 </p>
983 </dd>
984 <dt class="hdlist1">
985 --[no-]auto-maintenance
986 </dt>
987 <dt class="hdlist1">
988 --[no-]auto-gc
989 </dt>
990 <dd>
992 Run <code>git maintenance run --auto</code> at the end to perform automatic
993 repository maintenance if needed. (<code>--[no-]auto-gc</code> is a synonym.)
994 This is enabled by default.
995 </p>
996 </dd>
997 <dt class="hdlist1">
998 --[no-]write-commit-graph
999 </dt>
1000 <dd>
1002 Write a commit-graph after fetching. This overrides the config
1003 setting <code>fetch.writeCommitGraph</code>.
1004 </p>
1005 </dd>
1006 <dt class="hdlist1">
1007 --prefetch
1008 </dt>
1009 <dd>
1011 Modify the configured refspec to place all refs into the
1012 <code>refs/prefetch/</code> namespace. See the <code>prefetch</code> task in
1013 <a href="git-maintenance.html">git-maintenance(1)</a>.
1014 </p>
1015 </dd>
1016 <dt class="hdlist1">
1018 </dt>
1019 <dt class="hdlist1">
1020 --prune
1021 </dt>
1022 <dd>
1024 Before fetching, remove any remote-tracking references that no
1025 longer exist on the remote. Tags are not subject to pruning
1026 if they are fetched only because of the default tag
1027 auto-following or due to a --tags option. However, if tags
1028 are fetched due to an explicit refspec (either on the command
1029 line or in the remote configuration, for example if the remote
1030 was cloned with the --mirror option), then they are also
1031 subject to pruning. Supplying <code>--prune-tags</code> is a shorthand for
1032 providing the tag refspec.
1033 </p>
1034 <div class="paragraph"><p>See the PRUNING section below for more details.</p></div>
1035 </dd>
1036 <dt class="hdlist1">
1038 </dt>
1039 <dt class="hdlist1">
1040 --prune-tags
1041 </dt>
1042 <dd>
1044 Before fetching, remove any local tags that no longer exist on
1045 the remote if <code>--prune</code> is enabled. This option should be used
1046 more carefully, unlike <code>--prune</code> it will remove any local
1047 references (local tags) that have been created. This option is
1048 a shorthand for providing the explicit tag refspec along with
1049 <code>--prune</code>, see the discussion about that in its documentation.
1050 </p>
1051 <div class="paragraph"><p>See the PRUNING section below for more details.</p></div>
1052 </dd>
1053 <dt class="hdlist1">
1055 </dt>
1056 <dt class="hdlist1">
1057 --no-tags
1058 </dt>
1059 <dd>
1061 By default, tags that point at objects that are downloaded
1062 from the remote repository are fetched and stored locally.
1063 This option disables this automatic tag following. The default
1064 behavior for a remote may be specified with the remote.&lt;name&gt;.tagOpt
1065 setting. See <a href="git-config.html">git-config(1)</a>.
1066 </p>
1067 </dd>
1068 <dt class="hdlist1">
1069 --refetch
1070 </dt>
1071 <dd>
1073 Instead of negotiating with the server to avoid transferring commits and
1074 associated objects that are already present locally, this option fetches
1075 all objects as a fresh clone would. Use this to reapply a partial clone
1076 filter from configuration or using <code>--filter=</code> when the filter
1077 definition has changed. Automatic post-fetch maintenance will perform
1078 object database pack consolidation to remove any duplicate objects.
1079 </p>
1080 </dd>
1081 <dt class="hdlist1">
1082 --refmap=&lt;refspec&gt;
1083 </dt>
1084 <dd>
1086 When fetching refs listed on the command line, use the
1087 specified refspec (can be given more than once) to map the
1088 refs to remote-tracking branches, instead of the values of
1089 <code>remote.*.fetch</code> configuration variables for the remote
1090 repository. Providing an empty <code>&lt;refspec&gt;</code> to the
1091 <code>--refmap</code> option causes Git to ignore the configured
1092 refspecs and rely entirely on the refspecs supplied as
1093 command-line arguments. See section on "Configured Remote-tracking
1094 Branches" for details.
1095 </p>
1096 </dd>
1097 <dt class="hdlist1">
1099 </dt>
1100 <dt class="hdlist1">
1101 --tags
1102 </dt>
1103 <dd>
1105 Fetch all tags from the remote (i.e., fetch remote tags
1106 <code>refs/tags/*</code> into local tags with the same name), in addition
1107 to whatever else would otherwise be fetched. Using this
1108 option alone does not subject tags to pruning, even if --prune
1109 is used (though tags may be pruned anyway if they are also the
1110 destination of an explicit refspec; see <code>--prune</code>).
1111 </p>
1112 </dd>
1113 <dt class="hdlist1">
1114 --recurse-submodules[=(yes|on-demand|no)]
1115 </dt>
1116 <dd>
1118 This option controls if and under what conditions new commits of
1119 submodules should be fetched too. When recursing through submodules,
1120 <code>git fetch</code> always attempts to fetch "changed" submodules, that is, a
1121 submodule that has commits that are referenced by a newly fetched
1122 superproject commit but are missing in the local submodule clone. A
1123 changed submodule can be fetched as long as it is present locally e.g.
1124 in <code>$GIT_DIR/modules/</code> (see <a href="gitsubmodules.html">gitsubmodules(7)</a>); if the upstream
1125 adds a new submodule, that submodule cannot be fetched until it is
1126 cloned e.g. by <code>git submodule update</code>.
1127 </p>
1128 <div class="paragraph"><p>When set to <em>on-demand</em>, only changed submodules are fetched. When set
1129 to <em>yes</em>, all populated submodules are fetched and submodules that are
1130 both unpopulated and changed are fetched. When set to <em>no</em>, submodules
1131 are never fetched.</p></div>
1132 <div class="paragraph"><p>When unspecified, this uses the value of <code>fetch.recurseSubmodules</code> if it
1133 is set (see <a href="git-config.html">git-config(1)</a>), defaulting to <em>on-demand</em> if unset.
1134 When this option is used without any value, it defaults to <em>yes</em>.</p></div>
1135 </dd>
1136 <dt class="hdlist1">
1138 </dt>
1139 <dt class="hdlist1">
1140 --jobs=&lt;n&gt;
1141 </dt>
1142 <dd>
1144 Number of parallel children to be used for all forms of fetching.
1145 </p>
1146 <div class="paragraph"><p>If the <code>--multiple</code> option was specified, the different remotes will be fetched
1147 in parallel. If multiple submodules are fetched, they will be fetched in
1148 parallel. To control them independently, use the config settings
1149 <code>fetch.parallel</code> and <code>submodule.fetchJobs</code> (see <a href="git-config.html">git-config(1)</a>).</p></div>
1150 <div class="paragraph"><p>Typically, parallel recursive and multi-remote fetches will be faster. By
1151 default fetches are performed sequentially, not in parallel.</p></div>
1152 </dd>
1153 <dt class="hdlist1">
1154 --no-recurse-submodules
1155 </dt>
1156 <dd>
1158 Disable recursive fetching of submodules (this has the same effect as
1159 using the <code>--recurse-submodules=no</code> option).
1160 </p>
1161 </dd>
1162 <dt class="hdlist1">
1163 --set-upstream
1164 </dt>
1165 <dd>
1167 If the remote is fetched successfully, add upstream
1168 (tracking) reference, used by argument-less
1169 <a href="git-pull.html">git-pull(1)</a> and other commands. For more information,
1170 see <code>branch.&lt;name&gt;.merge</code> and <code>branch.&lt;name&gt;.remote</code> in
1171 <a href="git-config.html">git-config(1)</a>.
1172 </p>
1173 </dd>
1174 <dt class="hdlist1">
1175 --submodule-prefix=&lt;path&gt;
1176 </dt>
1177 <dd>
1179 Prepend &lt;path&gt; to paths printed in informative messages
1180 such as "Fetching submodule foo". This option is used
1181 internally when recursing over submodules.
1182 </p>
1183 </dd>
1184 <dt class="hdlist1">
1185 --recurse-submodules-default=[yes|on-demand]
1186 </dt>
1187 <dd>
1189 This option is used internally to temporarily provide a
1190 non-negative default value for the --recurse-submodules
1191 option. All other methods of configuring fetch&#8217;s submodule
1192 recursion (such as settings in <a href="gitmodules.html">gitmodules(5)</a> and
1193 <a href="git-config.html">git-config(1)</a>) override this option, as does
1194 specifying --[no-]recurse-submodules directly.
1195 </p>
1196 </dd>
1197 <dt class="hdlist1">
1199 </dt>
1200 <dt class="hdlist1">
1201 --update-head-ok
1202 </dt>
1203 <dd>
1205 By default <em>git fetch</em> refuses to update the head which
1206 corresponds to the current branch. This flag disables the
1207 check. This is purely for the internal use for <em>git pull</em>
1208 to communicate with <em>git fetch</em>, and unless you are
1209 implementing your own Porcelain you are not supposed to
1210 use it.
1211 </p>
1212 </dd>
1213 <dt class="hdlist1">
1214 --upload-pack &lt;upload-pack&gt;
1215 </dt>
1216 <dd>
1218 When given, and the repository to fetch from is handled
1219 by <em>git fetch-pack</em>, <code>--exec=&lt;upload-pack&gt;</code> is passed to
1220 the command to specify non-default path for the command
1221 run on the other end.
1222 </p>
1223 </dd>
1224 <dt class="hdlist1">
1226 </dt>
1227 <dt class="hdlist1">
1228 --quiet
1229 </dt>
1230 <dd>
1232 Pass --quiet to git-fetch-pack and silence any other internally
1233 used git commands. Progress is not reported to the standard error
1234 stream.
1235 </p>
1236 </dd>
1237 <dt class="hdlist1">
1239 </dt>
1240 <dt class="hdlist1">
1241 --verbose
1242 </dt>
1243 <dd>
1245 Be verbose.
1246 </p>
1247 </dd>
1248 <dt class="hdlist1">
1249 --progress
1250 </dt>
1251 <dd>
1253 Progress status is reported on the standard error stream
1254 by default when it is attached to a terminal, unless -q
1255 is specified. This flag forces progress status even if the
1256 standard error stream is not directed to a terminal.
1257 </p>
1258 </dd>
1259 <dt class="hdlist1">
1260 -o &lt;option&gt;
1261 </dt>
1262 <dt class="hdlist1">
1263 --server-option=&lt;option&gt;
1264 </dt>
1265 <dd>
1267 Transmit the given string to the server when communicating using
1268 protocol version 2. The given string must not contain a NUL or LF
1269 character. The server&#8217;s handling of server options, including
1270 unknown ones, is server-specific.
1271 When multiple <code>--server-option=&lt;option&gt;</code> are given, they are all
1272 sent to the other side in the order listed on the command line.
1273 </p>
1274 </dd>
1275 <dt class="hdlist1">
1276 --show-forced-updates
1277 </dt>
1278 <dd>
1280 By default, git checks if a branch is force-updated during
1281 fetch. This can be disabled through fetch.showForcedUpdates, but
1282 the --show-forced-updates option guarantees this check occurs.
1283 See <a href="git-config.html">git-config(1)</a>.
1284 </p>
1285 </dd>
1286 <dt class="hdlist1">
1287 --no-show-forced-updates
1288 </dt>
1289 <dd>
1291 By default, git checks if a branch is force-updated during
1292 fetch. Pass --no-show-forced-updates or set fetch.showForcedUpdates
1293 to false to skip this check for performance reasons. If used during
1294 <em>git-pull</em> the --ff-only option will still check for forced updates
1295 before attempting a fast-forward update. See <a href="git-config.html">git-config(1)</a>.
1296 </p>
1297 </dd>
1298 <dt class="hdlist1">
1300 </dt>
1301 <dt class="hdlist1">
1302 --ipv4
1303 </dt>
1304 <dd>
1306 Use IPv4 addresses only, ignoring IPv6 addresses.
1307 </p>
1308 </dd>
1309 <dt class="hdlist1">
1311 </dt>
1312 <dt class="hdlist1">
1313 --ipv6
1314 </dt>
1315 <dd>
1317 Use IPv6 addresses only, ignoring IPv4 addresses.
1318 </p>
1319 </dd>
1320 <dt class="hdlist1">
1321 &lt;repository&gt;
1322 </dt>
1323 <dd>
1325 The "remote" repository that is the source of a fetch
1326 or pull operation. This parameter can be either a URL
1327 (see the section <a href="#URLS">GIT URLS</a> below) or the name
1328 of a remote (see the section <a href="#REMOTES">REMOTES</a> below).
1329 </p>
1330 </dd>
1331 <dt class="hdlist1">
1332 &lt;group&gt;
1333 </dt>
1334 <dd>
1336 A name referring to a list of repositories as the value
1337 of remotes.&lt;group&gt; in the configuration file.
1338 (See <a href="git-config.html">git-config(1)</a>).
1339 </p>
1340 </dd>
1341 <dt class="hdlist1">
1342 &lt;refspec&gt;
1343 </dt>
1344 <dd>
1346 Specifies which refs to fetch and which local refs to update.
1347 When no &lt;refspec&gt;s appear on the command line, the refs to fetch
1348 are read from <code>remote.&lt;repository&gt;.fetch</code> variables instead
1349 (see <a href="#CRTB">CONFIGURED REMOTE-TRACKING BRANCHES</a> below).
1350 </p>
1351 <div class="paragraph"><p>The format of a &lt;refspec&gt; parameter is an optional plus
1352 <code>+</code>, followed by the source &lt;src&gt;, followed
1353 by a colon <code>:</code>, followed by the destination ref &lt;dst&gt;.
1354 The colon can be omitted when &lt;dst&gt; is empty. &lt;src&gt; is
1355 typically a ref, but it can also be a fully spelled hex object
1356 name.</p></div>
1357 <div class="paragraph"><p>A &lt;refspec&gt; may contain a <code>*</code> in its &lt;src&gt; to indicate a simple pattern
1358 match. Such a refspec functions like a glob that matches any ref with the
1359 same prefix. A pattern &lt;refspec&gt; must have a <code>*</code> in both the &lt;src&gt; and
1360 &lt;dst&gt;. It will map refs to the destination by replacing the <code>*</code> with the
1361 contents matched from the source.</p></div>
1362 <div class="paragraph"><p>If a refspec is prefixed by <code>^</code>, it will be interpreted as a negative
1363 refspec. Rather than specifying which refs to fetch or which local refs to
1364 update, such a refspec will instead specify refs to exclude. A ref will be
1365 considered to match if it matches at least one positive refspec, and does
1366 not match any negative refspec. Negative refspecs can be useful to restrict
1367 the scope of a pattern refspec so that it will not include specific refs.
1368 Negative refspecs can themselves be pattern refspecs. However, they may only
1369 contain a &lt;src&gt; and do not specify a &lt;dst&gt;. Fully spelled out hex object
1370 names are also not supported.</p></div>
1371 <div class="paragraph"><p><code>tag &lt;tag&gt;</code> means the same as <code>refs/tags/&lt;tag&gt;:refs/tags/&lt;tag&gt;</code>;
1372 it requests fetching everything up to the given tag.</p></div>
1373 <div class="paragraph"><p>The remote ref that matches &lt;src&gt;
1374 is fetched, and if &lt;dst&gt; is not an empty string, an attempt
1375 is made to update the local ref that matches it.</p></div>
1376 <div class="paragraph"><p>Whether that update is allowed without <code>--force</code> depends on the ref
1377 namespace it&#8217;s being fetched to, the type of object being fetched, and
1378 whether the update is considered to be a fast-forward. Generally, the
1379 same rules apply for fetching as when pushing, see the <code>&lt;refspec&gt;...</code>
1380 section of <a href="git-push.html">git-push(1)</a> for what those are. Exceptions to those
1381 rules particular to <em>git fetch</em> are noted below.</p></div>
1382 <div class="paragraph"><p>Until Git version 2.20, and unlike when pushing with
1383 <a href="git-push.html">git-push(1)</a>, any updates to <code>refs/tags/*</code> would be accepted
1384 without <code>+</code> in the refspec (or <code>--force</code>). When fetching, we promiscuously
1385 considered all tag updates from a remote to be forced fetches. Since
1386 Git version 2.20, fetching to update <code>refs/tags/*</code> works the same way
1387 as when pushing. I.e. any updates will be rejected without <code>+</code> in the
1388 refspec (or <code>--force</code>).</p></div>
1389 <div class="paragraph"><p>Unlike when pushing with <a href="git-push.html">git-push(1)</a>, any updates outside of
1390 <code>refs/{tags,heads}/*</code> will be accepted without <code>+</code> in the refspec (or
1391 <code>--force</code>), whether that&#8217;s swapping e.g. a tree object for a blob, or
1392 a commit for another commit that doesn&#8217;t have the previous commit as
1393 an ancestor etc.</p></div>
1394 <div class="paragraph"><p>Unlike when pushing with <a href="git-push.html">git-push(1)</a>, there is no
1395 configuration which&#8217;ll amend these rules, and nothing like a
1396 <code>pre-fetch</code> hook analogous to the <code>pre-receive</code> hook.</p></div>
1397 <div class="paragraph"><p>As with pushing with <a href="git-push.html">git-push(1)</a>, all of the rules described
1398 above about what&#8217;s not allowed as an update can be overridden by
1399 adding an optional leading <code>+</code> to a refspec (or using the <code>--force</code>
1400 command line option). The only exception to this is that no amount of
1401 forcing will make the <code>refs/heads/*</code> namespace accept a non-commit
1402 object.</p></div>
1403 <div class="admonitionblock">
1404 <table><tr>
1405 <td class="icon">
1406 <div class="title">Note</div>
1407 </td>
1408 <td class="content">When the remote branch you want to fetch is known to
1409 be rewound and rebased regularly, it is expected that
1410 its new tip will not be a descendant of its previous tip
1411 (as stored in your remote-tracking branch the last time
1412 you fetched). You would want
1413 to use the <code>+</code> sign to indicate non-fast-forward updates
1414 will be needed for such branches. There is no way to
1415 determine or declare that a branch will be made available
1416 in a repository with this behavior; the pulling user simply
1417 must know this is the expected usage pattern for a branch.</td>
1418 </tr></table>
1419 </div>
1420 </dd>
1421 <dt class="hdlist1">
1422 --stdin
1423 </dt>
1424 <dd>
1426 Read refspecs, one per line, from stdin in addition to those provided
1427 as arguments. The "tag &lt;name&gt;" format is not supported.
1428 </p>
1429 </dd>
1430 </dl></div>
1431 </div>
1432 </div>
1433 <div class="sect1">
1434 <h2 id="_git_urls_a_id_urls_a">GIT URLS<a id="URLS"></a></h2>
1435 <div class="sectionbody">
1436 <div class="paragraph"><p>In general, URLs contain information about the transport protocol, the
1437 address of the remote server, and the path to the repository.
1438 Depending on the transport protocol, some of this information may be
1439 absent.</p></div>
1440 <div class="paragraph"><p>Git supports ssh, git, http, and https protocols (in addition, ftp
1441 and ftps can be used for fetching, but this is inefficient and
1442 deprecated; do not use them).</p></div>
1443 <div class="paragraph"><p>The native transport (i.e. git:// URL) does no authentication and
1444 should be used with caution on unsecured networks.</p></div>
1445 <div class="paragraph"><p>The following syntaxes may be used with them:</p></div>
1446 <div class="ulist"><ul>
1447 <li>
1449 <code>ssh://</code>&#91;<em>&lt;user&gt;</em><code>@</code>&#93;<em>&lt;host&gt;</em>&#91;<code>:</code><em>&lt;port&gt;</em>&#93;<code>/</code><em>&lt;path-to-git-repo&gt;</em>
1450 </p>
1451 </li>
1452 <li>
1454 <code>git://</code><em>&lt;host&gt;</em>&#91;:<em>&lt;port&gt;</em>&#93;<code>/</code><em>&lt;path-to-git-repo&gt;</em>
1455 </p>
1456 </li>
1457 <li>
1459 <code>http</code>&#91;<code>s</code>&#93;<code>://</code><em>&lt;host&gt;</em>&#91;<code>:</code><em>&lt;port&gt;</em>&#93;<code>/</code><em>&lt;path-to-git-repo&gt;</em>
1460 </p>
1461 </li>
1462 <li>
1464 <code>ftp</code>&#91;<code>s</code>&#93;<code>://</code><em>&lt;host&gt;</em>&#91;<code>:</code><em>&lt;port&gt;</em>&#93;<code>/</code><em>&lt;path-to-git-repo&gt;</em>
1465 </p>
1466 </li>
1467 </ul></div>
1468 <div class="paragraph"><p>An alternative scp-like syntax may also be used with the ssh protocol:</p></div>
1469 <div class="ulist"><ul>
1470 <li>
1472 &#91;<em>&lt;user&gt;</em><code>@</code>&#93;<em>&lt;host&gt;</em><code>:/</code><em>&lt;path-to-git-repo&gt;</em>
1473 </p>
1474 </li>
1475 </ul></div>
1476 <div class="paragraph"><p>This syntax is only recognized if there are no slashes before the
1477 first colon. This helps differentiate a local path that contains a
1478 colon. For example the local path <code>foo:bar</code> could be specified as an
1479 absolute path or <code>./foo:bar</code> to avoid being misinterpreted as an ssh
1480 url.</p></div>
1481 <div class="paragraph"><p>The ssh and git protocols additionally support <code>~</code><em>&lt;username&gt;</em> expansion:</p></div>
1482 <div class="ulist"><ul>
1483 <li>
1485 <code>ssh://</code>&#91;<em>&lt;user&gt;</em><code>@</code>&#93;<em>&lt;host&gt;</em>&#91;<code>:</code><em>&lt;port&gt;</em>&#93;<code>/~</code><em>&lt;user&gt;</em><code>/</code><em>&lt;path-to-git-repo&gt;</em>
1486 </p>
1487 </li>
1488 <li>
1490 <code>git://</code><em>&lt;host&gt;</em>&#91;<code>:</code><em>&lt;port&gt;</em>&#93;<code>/~</code><em>&lt;user&gt;</em><code>/</code><em>&lt;path-to-git-repo&gt;</em>
1491 </p>
1492 </li>
1493 <li>
1495 &#91;<em>&lt;user&gt;</em><code>@</code>&#93;<em>&lt;host&gt;</em><code>:~</code><em>&lt;user&gt;</em><code>/</code><em>&lt;path-to-git-repo&gt;</em>
1496 </p>
1497 </li>
1498 </ul></div>
1499 <div class="paragraph"><p>For local repositories, also supported by Git natively, the following
1500 syntaxes may be used:</p></div>
1501 <div class="ulist"><ul>
1502 <li>
1504 <code>/path/to/repo.git/</code>
1505 </p>
1506 </li>
1507 <li>
1509 <code>file:///path/to/repo.git/</code>
1510 </p>
1511 </li>
1512 </ul></div>
1513 <div class="paragraph"><p>These two syntaxes are mostly equivalent, except when cloning, when
1514 the former implies <code>--local</code> option. See <a href="git-clone.html">git-clone(1)</a> for
1515 details.</p></div>
1516 <div class="paragraph"><p><code>git clone</code>, <code>git fetch</code> and <code>git pull</code>, but not <code>git push</code>, will also
1517 accept a suitable bundle file. See <a href="git-bundle.html">git-bundle(1)</a>.</p></div>
1518 <div class="paragraph"><p>When Git doesn&#8217;t know how to handle a certain transport protocol, it
1519 attempts to use the <code>remote-</code><em>&lt;transport&gt;</em> remote helper, if one
1520 exists. To explicitly request a remote helper, the following syntax
1521 may be used:</p></div>
1522 <div class="ulist"><ul>
1523 <li>
1525 <em>&lt;transport&gt;</em>::<em>&lt;address&gt;</em>
1526 </p>
1527 </li>
1528 </ul></div>
1529 <div class="paragraph"><p>where <em>&lt;address&gt;</em> may be a path, a server and path, or an arbitrary
1530 URL-like string recognized by the specific remote helper being
1531 invoked. See <a href="gitremote-helpers.html">gitremote-helpers(7)</a> for details.</p></div>
1532 <div class="paragraph"><p>If there are a large number of similarly-named remote repositories and
1533 you want to use a different format for them (such that the URLs you
1534 use will be rewritten into URLs that work), you can create a
1535 configuration section of the form:</p></div>
1536 <div class="verseblock">
1537 <pre class="content"> [url "<em>&lt;actual-url-base&gt;</em>"]
1538 insteadOf = <em>&lt;other-url-base&gt;</em></pre>
1539 <div class="attribution">
1540 </div></div>
1541 <div class="paragraph"><p>For example, with this:</p></div>
1542 <div class="listingblock">
1543 <div class="content">
1544 <pre><code> [url "git://git.host.xz/"]
1545 insteadOf = host.xz:/path/to/
1546 insteadOf = work:</code></pre>
1547 </div></div>
1548 <div class="paragraph"><p>a URL like "work:repo.git" or like "host.xz:/path/to/repo.git" will be
1549 rewritten in any context that takes a URL to be "git://git.host.xz/repo.git".</p></div>
1550 <div class="paragraph"><p>If you want to rewrite URLs for push only, you can create a
1551 configuration section of the form:</p></div>
1552 <div class="verseblock">
1553 <pre class="content"> [url "<em>&lt;actual-url-base&gt;</em>"]
1554 pushInsteadOf = <em>&lt;other-url-base&gt;</em></pre>
1555 <div class="attribution">
1556 </div></div>
1557 <div class="paragraph"><p>For example, with this:</p></div>
1558 <div class="listingblock">
1559 <div class="content">
1560 <pre><code> [url "ssh://example.org/"]
1561 pushInsteadOf = git://example.org/</code></pre>
1562 </div></div>
1563 <div class="paragraph"><p>a URL like "git://example.org/path/to/repo.git" will be rewritten to
1564 "ssh://example.org/path/to/repo.git" for pushes, but pulls will still
1565 use the original URL.</p></div>
1566 </div>
1567 </div>
1568 <div class="sect1">
1569 <h2 id="_remotes_a_id_remotes_a">REMOTES<a id="REMOTES"></a></h2>
1570 <div class="sectionbody">
1571 <div class="paragraph"><p>The name of one of the following can be used instead
1572 of a URL as <code>&lt;repository&gt;</code> argument:</p></div>
1573 <div class="ulist"><ul>
1574 <li>
1576 a remote in the Git configuration file: <code>$GIT_DIR/config</code>,
1577 </p>
1578 </li>
1579 <li>
1581 a file in the <code>$GIT_DIR/remotes</code> directory, or
1582 </p>
1583 </li>
1584 <li>
1586 a file in the <code>$GIT_DIR/branches</code> directory.
1587 </p>
1588 </li>
1589 </ul></div>
1590 <div class="paragraph"><p>All of these also allow you to omit the refspec from the command line
1591 because they each contain a refspec which git will use by default.</p></div>
1592 <div class="sect2">
1593 <h3 id="_named_remote_in_configuration_file">Named remote in configuration file</h3>
1594 <div class="paragraph"><p>You can choose to provide the name of a remote which you had previously
1595 configured using <a href="git-remote.html">git-remote(1)</a>, <a href="git-config.html">git-config(1)</a>
1596 or even by a manual edit to the <code>$GIT_DIR/config</code> file. The URL of
1597 this remote will be used to access the repository. The refspec
1598 of this remote will be used by default when you do
1599 not provide a refspec on the command line. The entry in the
1600 config file would appear like this:</p></div>
1601 <div class="listingblock">
1602 <div class="content">
1603 <pre><code> [remote "&lt;name&gt;"]
1604 url = &lt;URL&gt;
1605 pushurl = &lt;pushurl&gt;
1606 push = &lt;refspec&gt;
1607 fetch = &lt;refspec&gt;</code></pre>
1608 </div></div>
1609 <div class="paragraph"><p>The <code>&lt;pushurl&gt;</code> is used for pushes only. It is optional and defaults
1610 to <code>&lt;URL&gt;</code>. Pushing to a remote affects all defined pushurls or all
1611 defined urls if no pushurls are defined. Fetch, however, will only
1612 fetch from the first defined url if multiple urls are defined.</p></div>
1613 </div>
1614 <div class="sect2">
1615 <h3 id="_named_file_in_code_git_dir_remotes_code">Named file in <code>$GIT_DIR/remotes</code></h3>
1616 <div class="paragraph"><p>You can choose to provide the name of a
1617 file in <code>$GIT_DIR/remotes</code>. The URL
1618 in this file will be used to access the repository. The refspec
1619 in this file will be used as default when you do not
1620 provide a refspec on the command line. This file should have the
1621 following format:</p></div>
1622 <div class="listingblock">
1623 <div class="content">
1624 <pre><code> URL: one of the above URL formats
1625 Push: &lt;refspec&gt;
1626 Pull: &lt;refspec&gt;</code></pre>
1627 </div></div>
1628 <div class="paragraph"><p><code>Push:</code> lines are used by <em>git push</em> and
1629 <code>Pull:</code> lines are used by <em>git pull</em> and <em>git fetch</em>.
1630 Multiple <code>Push:</code> and <code>Pull:</code> lines may
1631 be specified for additional branch mappings.</p></div>
1632 </div>
1633 <div class="sect2">
1634 <h3 id="_named_file_in_code_git_dir_branches_code">Named file in <code>$GIT_DIR/branches</code></h3>
1635 <div class="paragraph"><p>You can choose to provide the name of a
1636 file in <code>$GIT_DIR/branches</code>.
1637 The URL in this file will be used to access the repository.
1638 This file should have the following format:</p></div>
1639 <div class="listingblock">
1640 <div class="content">
1641 <pre><code> &lt;URL&gt;#&lt;head&gt;</code></pre>
1642 </div></div>
1643 <div class="paragraph"><p><code>&lt;URL&gt;</code> is required; <code>#&lt;head&gt;</code> is optional.</p></div>
1644 <div class="paragraph"><p>Depending on the operation, git will use one of the following
1645 refspecs, if you don&#8217;t provide one on the command line.
1646 <code>&lt;branch&gt;</code> is the name of this file in <code>$GIT_DIR/branches</code> and
1647 <code>&lt;head&gt;</code> defaults to <code>master</code>.</p></div>
1648 <div class="paragraph"><p>git fetch uses:</p></div>
1649 <div class="listingblock">
1650 <div class="content">
1651 <pre><code> refs/heads/&lt;head&gt;:refs/heads/&lt;branch&gt;</code></pre>
1652 </div></div>
1653 <div class="paragraph"><p>git push uses:</p></div>
1654 <div class="listingblock">
1655 <div class="content">
1656 <pre><code> HEAD:refs/heads/&lt;head&gt;</code></pre>
1657 </div></div>
1658 </div>
1659 </div>
1660 </div>
1661 <div class="sect1">
1662 <h2 id="_configured_remote_tracking_branches_a_id_crtb_a">CONFIGURED REMOTE-TRACKING BRANCHES<a id="CRTB"></a></h2>
1663 <div class="sectionbody">
1664 <div class="paragraph"><p>You often interact with the same remote repository by
1665 regularly and repeatedly fetching from it. In order to keep track
1666 of the progress of such a remote repository, <code>git fetch</code> allows you
1667 to configure <code>remote.&lt;repository&gt;.fetch</code> configuration variables.</p></div>
1668 <div class="paragraph"><p>Typically such a variable may look like this:</p></div>
1669 <div class="listingblock">
1670 <div class="content">
1671 <pre><code>[remote "origin"]
1672 fetch = +refs/heads/*:refs/remotes/origin/*</code></pre>
1673 </div></div>
1674 <div class="paragraph"><p>This configuration is used in two ways:</p></div>
1675 <div class="ulist"><ul>
1676 <li>
1678 When <code>git fetch</code> is run without specifying what branches
1679 and/or tags to fetch on the command line, e.g. <code>git fetch origin</code>
1680 or <code>git fetch</code>, <code>remote.&lt;repository&gt;.fetch</code> values are used as
1681 the refspecs&#8212;they specify which refs to fetch and which local refs
1682 to update. The example above will fetch
1683 all branches that exist in the <code>origin</code> (i.e. any ref that matches
1684 the left-hand side of the value, <code>refs/heads/*</code>) and update the
1685 corresponding remote-tracking branches in the <code>refs/remotes/origin/*</code>
1686 hierarchy.
1687 </p>
1688 </li>
1689 <li>
1691 When <code>git fetch</code> is run with explicit branches and/or tags
1692 to fetch on the command line, e.g. <code>git fetch origin master</code>, the
1693 &lt;refspec&gt;s given on the command line determine what are to be
1694 fetched (e.g. <code>master</code> in the example,
1695 which is a short-hand for <code>master:</code>, which in turn means
1696 "fetch the <em>master</em> branch but I do not explicitly say what
1697 remote-tracking branch to update with it from the command line"),
1698 and the example command will
1699 fetch <em>only</em> the <em>master</em> branch. The <code>remote.&lt;repository&gt;.fetch</code>
1700 values determine which
1701 remote-tracking branch, if any, is updated. When used in this
1702 way, the <code>remote.&lt;repository&gt;.fetch</code> values do not have any
1703 effect in deciding <em>what</em> gets fetched (i.e. the values are not
1704 used as refspecs when the command-line lists refspecs); they are
1705 only used to decide <em>where</em> the refs that are fetched are stored
1706 by acting as a mapping.
1707 </p>
1708 </li>
1709 </ul></div>
1710 <div class="paragraph"><p>The latter use of the <code>remote.&lt;repository&gt;.fetch</code> values can be
1711 overridden by giving the <code>--refmap=&lt;refspec&gt;</code> parameter(s) on the
1712 command line.</p></div>
1713 </div>
1714 </div>
1715 <div class="sect1">
1716 <h2 id="_pruning">PRUNING</h2>
1717 <div class="sectionbody">
1718 <div class="paragraph"><p>Git has a default disposition of keeping data unless it&#8217;s explicitly
1719 thrown away; this extends to holding onto local references to branches
1720 on remotes that have themselves deleted those branches.</p></div>
1721 <div class="paragraph"><p>If left to accumulate, these stale references might make performance
1722 worse on big and busy repos that have a lot of branch churn, and
1723 e.g. make the output of commands like <code>git branch -a --contains
1724 &lt;commit&gt;</code> needlessly verbose, as well as impacting anything else
1725 that&#8217;ll work with the complete set of known references.</p></div>
1726 <div class="paragraph"><p>These remote-tracking references can be deleted as a one-off with
1727 either of:</p></div>
1728 <div class="listingblock">
1729 <div class="content">
1730 <pre><code># While fetching
1731 $ git fetch --prune &lt;name&gt;
1733 # Only prune, don't fetch
1734 $ git remote prune &lt;name&gt;</code></pre>
1735 </div></div>
1736 <div class="paragraph"><p>To prune references as part of your normal workflow without needing to
1737 remember to run that, set <code>fetch.prune</code> globally, or
1738 <code>remote.&lt;name&gt;.prune</code> per-remote in the config. See
1739 <a href="git-config.html">git-config(1)</a>.</p></div>
1740 <div class="paragraph"><p>Here&#8217;s where things get tricky and more specific. The pruning feature
1741 doesn&#8217;t actually care about branches, instead it&#8217;ll prune local &#8592;&#8594;
1742 remote-references as a function of the refspec of the remote (see
1743 <code>&lt;refspec&gt;</code> and <a href="#CRTB">CONFIGURED REMOTE-TRACKING BRANCHES</a> above).</p></div>
1744 <div class="paragraph"><p>Therefore if the refspec for the remote includes
1745 e.g. <code>refs/tags/*:refs/tags/*</code>, or you manually run e.g. <code>git fetch
1746 --prune &lt;name&gt; "refs/tags/*:refs/tags/*"</code> it won&#8217;t be stale remote
1747 tracking branches that are deleted, but any local tag that doesn&#8217;t
1748 exist on the remote.</p></div>
1749 <div class="paragraph"><p>This might not be what you expect, i.e. you want to prune remote
1750 <code>&lt;name&gt;</code>, but also explicitly fetch tags from it, so when you fetch
1751 from it you delete all your local tags, most of which may not have
1752 come from the <code>&lt;name&gt;</code> remote in the first place.</p></div>
1753 <div class="paragraph"><p>So be careful when using this with a refspec like
1754 <code>refs/tags/*:refs/tags/*</code>, or any other refspec which might map
1755 references from multiple remotes to the same local namespace.</p></div>
1756 <div class="paragraph"><p>Since keeping up-to-date with both branches and tags on the remote is
1757 a common use-case the <code>--prune-tags</code> option can be supplied along with
1758 <code>--prune</code> to prune local tags that don&#8217;t exist on the remote, and
1759 force-update those tags that differ. Tag pruning can also be enabled
1760 with <code>fetch.pruneTags</code> or <code>remote.&lt;name&gt;.pruneTags</code> in the config. See
1761 <a href="git-config.html">git-config(1)</a>.</p></div>
1762 <div class="paragraph"><p>The <code>--prune-tags</code> option is equivalent to having
1763 <code>refs/tags/*:refs/tags/*</code> declared in the refspecs of the remote. This
1764 can lead to some seemingly strange interactions:</p></div>
1765 <div class="listingblock">
1766 <div class="content">
1767 <pre><code># These both fetch tags
1768 $ git fetch --no-tags origin 'refs/tags/*:refs/tags/*'
1769 $ git fetch --no-tags --prune-tags origin</code></pre>
1770 </div></div>
1771 <div class="paragraph"><p>The reason it doesn&#8217;t error out when provided without <code>--prune</code> or its
1772 config versions is for flexibility of the configured versions, and to
1773 maintain a 1=1 mapping between what the command line flags do, and
1774 what the configuration versions do.</p></div>
1775 <div class="paragraph"><p>It&#8217;s reasonable to e.g. configure <code>fetch.pruneTags=true</code> in
1776 <code>~/.gitconfig</code> to have tags pruned whenever <code>git fetch --prune</code> is
1777 run, without making every invocation of <code>git fetch</code> without <code>--prune</code>
1778 an error.</p></div>
1779 <div class="paragraph"><p>Pruning tags with <code>--prune-tags</code> also works when fetching a URL
1780 instead of a named remote. These will all prune tags not found on
1781 origin:</p></div>
1782 <div class="listingblock">
1783 <div class="content">
1784 <pre><code>$ git fetch origin --prune --prune-tags
1785 $ git fetch origin --prune 'refs/tags/*:refs/tags/*'
1786 $ git fetch &lt;url-of-origin&gt; --prune --prune-tags
1787 $ git fetch &lt;url-of-origin&gt; --prune 'refs/tags/*:refs/tags/*'</code></pre>
1788 </div></div>
1789 </div>
1790 </div>
1791 <div class="sect1">
1792 <h2 id="_output">OUTPUT</h2>
1793 <div class="sectionbody">
1794 <div class="paragraph"><p>The output of "git fetch" depends on the transport method used; this
1795 section describes the output when fetching over the Git protocol
1796 (either locally or via ssh) and Smart HTTP protocol.</p></div>
1797 <div class="paragraph"><p>The status of the fetch is output in tabular form, with each line
1798 representing the status of a single ref. Each line is of the form:</p></div>
1799 <div class="listingblock">
1800 <div class="content">
1801 <pre><code> &lt;flag&gt; &lt;summary&gt; &lt;from&gt; -&gt; &lt;to&gt; [&lt;reason&gt;]</code></pre>
1802 </div></div>
1803 <div class="paragraph"><p>When using <code>--porcelain</code>, the output format is intended to be
1804 machine-parseable. In contrast to the human-readable output formats it
1805 thus prints to standard output instead of standard error. Each line is
1806 of the form:</p></div>
1807 <div class="listingblock">
1808 <div class="content">
1809 <pre><code>&lt;flag&gt; &lt;old-object-id&gt; &lt;new-object-id&gt; &lt;local-reference&gt;</code></pre>
1810 </div></div>
1811 <div class="paragraph"><p>The status of up-to-date refs is shown only if the --verbose option is
1812 used.</p></div>
1813 <div class="paragraph"><p>In compact output mode, specified with configuration variable
1814 fetch.output, if either entire <code>&lt;from&gt;</code> or <code>&lt;to&gt;</code> is found in the
1815 other string, it will be substituted with <code>*</code> in the other string. For
1816 example, <code>master -&gt; origin/master</code> becomes <code>master -&gt; origin/*</code>.</p></div>
1817 <div class="dlist"><dl>
1818 <dt class="hdlist1">
1819 flag
1820 </dt>
1821 <dd>
1823 A single character indicating the status of the ref:
1824 </p>
1825 <div class="dlist"><dl>
1826 <dt class="hdlist1">
1827 (space)
1828 </dt>
1829 <dd>
1831 for a successfully fetched fast-forward;
1832 </p>
1833 </dd>
1834 <dt class="hdlist1">
1835 <code>+</code>
1836 </dt>
1837 <dd>
1839 for a successful forced update;
1840 </p>
1841 </dd>
1842 <dt class="hdlist1">
1843 <code>-</code>
1844 </dt>
1845 <dd>
1847 for a successfully pruned ref;
1848 </p>
1849 </dd>
1850 <dt class="hdlist1">
1851 <code>t</code>
1852 </dt>
1853 <dd>
1855 for a successful tag update;
1856 </p>
1857 </dd>
1858 <dt class="hdlist1">
1859 <code>*</code>
1860 </dt>
1861 <dd>
1863 for a successfully fetched new ref;
1864 </p>
1865 </dd>
1866 <dt class="hdlist1">
1867 <code>!</code>
1868 </dt>
1869 <dd>
1871 for a ref that was rejected or failed to update; and
1872 </p>
1873 </dd>
1874 <dt class="hdlist1">
1875 <code>=</code>
1876 </dt>
1877 <dd>
1879 for a ref that was up to date and did not need fetching.
1880 </p>
1881 </dd>
1882 </dl></div>
1883 </dd>
1884 <dt class="hdlist1">
1885 summary
1886 </dt>
1887 <dd>
1889 For a successfully fetched ref, the summary shows the old and new
1890 values of the ref in a form suitable for using as an argument to
1891 <code>git log</code> (this is <code>&lt;old&gt;..&lt;new&gt;</code> in most cases, and
1892 <code>&lt;old&gt;...&lt;new&gt;</code> for forced non-fast-forward updates).
1893 </p>
1894 </dd>
1895 <dt class="hdlist1">
1896 from
1897 </dt>
1898 <dd>
1900 The name of the remote ref being fetched from, minus its
1901 <code>refs/&lt;type&gt;/</code> prefix. In the case of deletion, the name of
1902 the remote ref is "(none)".
1903 </p>
1904 </dd>
1905 <dt class="hdlist1">
1907 </dt>
1908 <dd>
1910 The name of the local ref being updated, minus its
1911 <code>refs/&lt;type&gt;/</code> prefix.
1912 </p>
1913 </dd>
1914 <dt class="hdlist1">
1915 reason
1916 </dt>
1917 <dd>
1919 A human-readable explanation. In the case of successfully fetched
1920 refs, no explanation is needed. For a failed ref, the reason for
1921 failure is described.
1922 </p>
1923 </dd>
1924 </dl></div>
1925 </div>
1926 </div>
1927 <div class="sect1">
1928 <h2 id="_examples">EXAMPLES</h2>
1929 <div class="sectionbody">
1930 <div class="ulist"><ul>
1931 <li>
1933 Update the remote-tracking branches:
1934 </p>
1935 <div class="listingblock">
1936 <div class="content">
1937 <pre><code>$ git fetch origin</code></pre>
1938 </div></div>
1939 <div class="paragraph"><p>The above command copies all branches from the remote <code>refs/heads/</code>
1940 namespace and stores them to the local <code>refs/remotes/origin/</code> namespace,
1941 unless the <code>remote.&lt;repository&gt;.fetch</code> option is used to specify a
1942 non-default refspec.</p></div>
1943 </li>
1944 <li>
1946 Using refspecs explicitly:
1947 </p>
1948 <div class="listingblock">
1949 <div class="content">
1950 <pre><code>$ git fetch origin +seen:seen maint:tmp</code></pre>
1951 </div></div>
1952 <div class="paragraph"><p>This updates (or creates, as necessary) branches <code>seen</code> and <code>tmp</code> in
1953 the local repository by fetching from the branches (respectively)
1954 <code>seen</code> and <code>maint</code> from the remote repository.</p></div>
1955 <div class="paragraph"><p>The <code>seen</code> branch will be updated even if it does not fast-forward,
1956 because it is prefixed with a plus sign; <code>tmp</code> will not be.</p></div>
1957 </li>
1958 <li>
1960 Peek at a remote&#8217;s branch, without configuring the remote in your local
1961 repository:
1962 </p>
1963 <div class="listingblock">
1964 <div class="content">
1965 <pre><code>$ git fetch git://git.kernel.org/pub/scm/git/git.git maint
1966 $ git log FETCH_HEAD</code></pre>
1967 </div></div>
1968 <div class="paragraph"><p>The first command fetches the <code>maint</code> branch from the repository at
1969 <code>git://git.kernel.org/pub/scm/git/git.git</code> and the second command uses
1970 <code>FETCH_HEAD</code> to examine the branch with <a href="git-log.html">git-log(1)</a>. The fetched
1971 objects will eventually be removed by git&#8217;s built-in housekeeping (see
1972 <a href="git-gc.html">git-gc(1)</a>).</p></div>
1973 </li>
1974 </ul></div>
1975 </div>
1976 </div>
1977 <div class="sect1">
1978 <h2 id="_security">SECURITY</h2>
1979 <div class="sectionbody">
1980 <div class="paragraph"><p>The fetch and push protocols are not designed to prevent one side from
1981 stealing data from the other repository that was not intended to be
1982 shared. If you have private data that you need to protect from a malicious
1983 peer, your best option is to store it in another repository. This applies
1984 to both clients and servers. In particular, namespaces on a server are not
1985 effective for read access control; you should only grant read access to a
1986 namespace to clients that you would trust with read access to the entire
1987 repository.</p></div>
1988 <div class="paragraph"><p>The known attack vectors are as follows:</p></div>
1989 <div class="olist arabic"><ol class="arabic">
1990 <li>
1992 The victim sends "have" lines advertising the IDs of objects it has that
1993 are not explicitly intended to be shared but can be used to optimize the
1994 transfer if the peer also has them. The attacker chooses an object ID X
1995 to steal and sends a ref to X, but isn&#8217;t required to send the content of
1996 X because the victim already has it. Now the victim believes that the
1997 attacker has X, and it sends the content of X back to the attacker
1998 later. (This attack is most straightforward for a client to perform on a
1999 server, by creating a ref to X in the namespace the client has access
2000 to and then fetching it. The most likely way for a server to perform it
2001 on a client is to "merge" X into a public branch and hope that the user
2002 does additional work on this branch and pushes it back to the server
2003 without noticing the merge.)
2004 </p>
2005 </li>
2006 <li>
2008 As in #1, the attacker chooses an object ID X to steal. The victim sends
2009 an object Y that the attacker already has, and the attacker falsely
2010 claims to have X and not Y, so the victim sends Y as a delta against X.
2011 The delta reveals regions of X that are similar to Y to the attacker.
2012 </p>
2013 </li>
2014 </ol></div>
2015 </div>
2016 </div>
2017 <div class="sect1">
2018 <h2 id="_configuration">CONFIGURATION</h2>
2019 <div class="sectionbody">
2020 <div class="paragraph"><p>Everything below this line in this section is selectively included
2021 from the <a href="git-config.html">git-config(1)</a> documentation. The content is the same
2022 as what&#8217;s found there:</p></div>
2023 <div class="dlist"><dl>
2024 <dt class="hdlist1">
2025 fetch.recurseSubmodules
2026 </dt>
2027 <dd>
2029 This option controls whether <code>git fetch</code> (and the underlying fetch
2030 in <code>git pull</code>) will recursively fetch into populated submodules.
2031 This option can be set either to a boolean value or to <em>on-demand</em>.
2032 Setting it to a boolean changes the behavior of fetch and pull to
2033 recurse unconditionally into submodules when set to true or to not
2034 recurse at all when set to false. When set to <em>on-demand</em>, fetch and
2035 pull will only recurse into a populated submodule when its
2036 superproject retrieves a commit that updates the submodule&#8217;s
2037 reference.
2038 Defaults to <em>on-demand</em>, or to the value of <em>submodule.recurse</em> if set.
2039 </p>
2040 </dd>
2041 <dt class="hdlist1">
2042 fetch.fsckObjects
2043 </dt>
2044 <dd>
2046 If it is set to true, git-fetch-pack will check all fetched
2047 objects. See <code>transfer.fsckObjects</code> for what&#8217;s
2048 checked. Defaults to false. If not set, the value of
2049 <code>transfer.fsckObjects</code> is used instead.
2050 </p>
2051 </dd>
2052 <dt class="hdlist1">
2053 fetch.fsck.&lt;msg-id&gt;
2054 </dt>
2055 <dd>
2057 Acts like <code>fsck.&lt;msg-id&gt;</code>, but is used by
2058 <a href="git-fetch-pack.html">git-fetch-pack(1)</a> instead of <a href="git-fsck.html">git-fsck(1)</a>. See
2059 the <code>fsck.&lt;msg-id&gt;</code> documentation for details.
2060 </p>
2061 </dd>
2062 <dt class="hdlist1">
2063 fetch.fsck.skipList
2064 </dt>
2065 <dd>
2067 Acts like <code>fsck.skipList</code>, but is used by
2068 <a href="git-fetch-pack.html">git-fetch-pack(1)</a> instead of <a href="git-fsck.html">git-fsck(1)</a>. See
2069 the <code>fsck.skipList</code> documentation for details.
2070 </p>
2071 </dd>
2072 <dt class="hdlist1">
2073 fetch.unpackLimit
2074 </dt>
2075 <dd>
2077 If the number of objects fetched over the Git native
2078 transfer is below this
2079 limit, then the objects will be unpacked into loose object
2080 files. However if the number of received objects equals or
2081 exceeds this limit then the received pack will be stored as
2082 a pack, after adding any missing delta bases. Storing the
2083 pack from a push can make the push operation complete faster,
2084 especially on slow filesystems. If not set, the value of
2085 <code>transfer.unpackLimit</code> is used instead.
2086 </p>
2087 </dd>
2088 <dt class="hdlist1">
2089 fetch.prune
2090 </dt>
2091 <dd>
2093 If true, fetch will automatically behave as if the <code>--prune</code>
2094 option was given on the command line. See also <code>remote.&lt;name&gt;.prune</code>
2095 and the PRUNING section of <a href="git-fetch.html">git-fetch(1)</a>.
2096 </p>
2097 </dd>
2098 <dt class="hdlist1">
2099 fetch.pruneTags
2100 </dt>
2101 <dd>
2103 If true, fetch will automatically behave as if the
2104 <code>refs/tags/*:refs/tags/*</code> refspec was provided when pruning,
2105 if not set already. This allows for setting both this option
2106 and <code>fetch.prune</code> to maintain a 1=1 mapping to upstream
2107 refs. See also <code>remote.&lt;name&gt;.pruneTags</code> and the PRUNING
2108 section of <a href="git-fetch.html">git-fetch(1)</a>.
2109 </p>
2110 </dd>
2111 <dt class="hdlist1">
2112 fetch.all
2113 </dt>
2114 <dd>
2116 If true, fetch will attempt to update all available remotes.
2117 This behavior can be overridden by passing <code>--no-all</code> or by
2118 explicitly specifying one or more remote(s) to fetch from.
2119 Defaults to false.
2120 </p>
2121 </dd>
2122 <dt class="hdlist1">
2123 fetch.output
2124 </dt>
2125 <dd>
2127 Control how ref update status is printed. Valid values are
2128 <code>full</code> and <code>compact</code>. Default value is <code>full</code>. See the
2129 OUTPUT section in <a href="git-fetch.html">git-fetch(1)</a> for details.
2130 </p>
2131 </dd>
2132 <dt class="hdlist1">
2133 fetch.negotiationAlgorithm
2134 </dt>
2135 <dd>
2137 Control how information about the commits in the local repository
2138 is sent when negotiating the contents of the packfile to be sent by
2139 the server. Set to "consecutive" to use an algorithm that walks
2140 over consecutive commits checking each one. Set to "skipping" to
2141 use an algorithm that skips commits in an effort to converge
2142 faster, but may result in a larger-than-necessary packfile; or set
2143 to "noop" to not send any information at all, which will almost
2144 certainly result in a larger-than-necessary packfile, but will skip
2145 the negotiation step. Set to "default" to override settings made
2146 previously and use the default behaviour. The default is normally
2147 "consecutive", but if <code>feature.experimental</code> is true, then the
2148 default is "skipping". Unknown values will cause <em>git fetch</em> to
2149 error out.
2150 </p>
2151 <div class="paragraph"><p>See also the <code>--negotiate-only</code> and <code>--negotiation-tip</code> options to
2152 <a href="git-fetch.html">git-fetch(1)</a>.</p></div>
2153 </dd>
2154 <dt class="hdlist1">
2155 fetch.showForcedUpdates
2156 </dt>
2157 <dd>
2159 Set to false to enable <code>--no-show-forced-updates</code> in
2160 <a href="git-fetch.html">git-fetch(1)</a> and <a href="git-pull.html">git-pull(1)</a> commands.
2161 Defaults to true.
2162 </p>
2163 </dd>
2164 <dt class="hdlist1">
2165 fetch.parallel
2166 </dt>
2167 <dd>
2169 Specifies the maximal number of fetch operations to be run in parallel
2170 at a time (submodules, or remotes when the <code>--multiple</code> option of
2171 <a href="git-fetch.html">git-fetch(1)</a> is in effect).
2172 </p>
2173 <div class="paragraph"><p>A value of 0 will give some reasonable default. If unset, it defaults to 1.</p></div>
2174 <div class="paragraph"><p>For submodules, this setting can be overridden using the <code>submodule.fetchJobs</code>
2175 config setting.</p></div>
2176 </dd>
2177 <dt class="hdlist1">
2178 fetch.writeCommitGraph
2179 </dt>
2180 <dd>
2182 Set to true to write a commit-graph after every <code>git fetch</code> command
2183 that downloads a pack-file from a remote. Using the <code>--split</code> option,
2184 most executions will create a very small commit-graph file on top of
2185 the existing commit-graph file(s). Occasionally, these files will
2186 merge and the write may take longer. Having an updated commit-graph
2187 file helps performance of many Git commands, including <code>git merge-base</code>,
2188 <code>git push -f</code>, and <code>git log --graph</code>. Defaults to false.
2189 </p>
2190 </dd>
2191 <dt class="hdlist1">
2192 fetch.bundleURI
2193 </dt>
2194 <dd>
2196 This value stores a URI for downloading Git object data from a bundle
2197 URI before performing an incremental fetch from the origin Git server.
2198 This is similar to how the <code>--bundle-uri</code> option behaves in
2199 <a href="git-clone.html">git-clone(1)</a>. <code>git clone --bundle-uri</code> will set the
2200 <code>fetch.bundleURI</code> value if the supplied bundle URI contains a bundle
2201 list that is organized for incremental fetches.
2202 </p>
2203 <div class="paragraph"><p>If you modify this value and your repository has a <code>fetch.bundleCreationToken</code>
2204 value, then remove that <code>fetch.bundleCreationToken</code> value before fetching from
2205 the new bundle URI.</p></div>
2206 </dd>
2207 <dt class="hdlist1">
2208 fetch.bundleCreationToken
2209 </dt>
2210 <dd>
2212 When using <code>fetch.bundleURI</code> to fetch incrementally from a bundle
2213 list that uses the "creationToken" heuristic, this config value
2214 stores the maximum <code>creationToken</code> value of the downloaded bundles.
2215 This value is used to prevent downloading bundles in the future
2216 if the advertised <code>creationToken</code> is not strictly larger than this
2217 value.
2218 </p>
2219 <div class="paragraph"><p>The creation token values are chosen by the provider serving the specific
2220 bundle URI. If you modify the URI at <code>fetch.bundleURI</code>, then be sure to
2221 remove the value for the <code>fetch.bundleCreationToken</code> value before fetching.</p></div>
2222 </dd>
2223 </dl></div>
2224 </div>
2225 </div>
2226 <div class="sect1">
2227 <h2 id="_bugs">BUGS</h2>
2228 <div class="sectionbody">
2229 <div class="paragraph"><p>Using --recurse-submodules can only fetch new commits in submodules that are
2230 present locally e.g. in <code>$GIT_DIR/modules/</code>. If the upstream adds a new
2231 submodule, that submodule cannot be fetched until it is cloned e.g. by <code>git
2232 submodule update</code>. This is expected to be fixed in a future Git version.</p></div>
2233 </div>
2234 </div>
2235 <div class="sect1">
2236 <h2 id="_see_also">SEE ALSO</h2>
2237 <div class="sectionbody">
2238 <div class="paragraph"><p><a href="git-pull.html">git-pull(1)</a></p></div>
2239 </div>
2240 </div>
2241 <div class="sect1">
2242 <h2 id="_git">GIT</h2>
2243 <div class="sectionbody">
2244 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
2245 </div>
2246 </div>
2247 </div>
2248 <div id="footnotes"><hr /></div>
2249 <div id="footer">
2250 <div id="footer-text">
2251 Last updated
2252 2024-02-08 15:45:59 PST
2253 </div>
2254 </div>
2255 </body>
2256 </html>