Autogenerated HTML docs for v2.42.0-241-g6bdb5
[git-htmldocs.git] / git-pull.html
blob044fe1f89364e94717e256166ed66ff0e50d5549
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-pull(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-pull(1) Manual Page
739 </h1>
740 <h2>NAME</h2>
741 <div class="sectionbody">
742 <p>git-pull -
743 Fetch from and integrate with another repository or a local branch
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 pull</em> [&lt;options&gt;] [&lt;repository&gt; [&lt;refspec&gt;&#8230;]]</pre>
753 <div class="attribution">
754 </div></div>
755 </div>
756 </div>
757 <div class="sect1">
758 <h2 id="_description">DESCRIPTION</h2>
759 <div class="sectionbody">
760 <div class="paragraph"><p>Incorporates changes from a remote repository into the current branch.
761 If the current branch is behind the remote, then by default it will
762 fast-forward the current branch to match the remote. If the current
763 branch and the remote have diverged, the user needs to specify how to
764 reconcile the divergent branches with <code>--rebase</code> or <code>--no-rebase</code> (or
765 the corresponding configuration option in <code>pull.rebase</code>).</p></div>
766 <div class="paragraph"><p>More precisely, <code>git pull</code> runs <code>git fetch</code> with the given parameters
767 and then depending on configuration options or command line flags,
768 will call either <code>git rebase</code> or <code>git merge</code> to reconcile diverging
769 branches.</p></div>
770 <div class="paragraph"><p>&lt;repository&gt; should be the name of a remote repository as
771 passed to <a href="git-fetch.html">git-fetch(1)</a>. &lt;refspec&gt; can name an
772 arbitrary remote ref (for example, the name of a tag) or even
773 a collection of refs with corresponding remote-tracking branches
774 (e.g., refs/heads/&#42;:refs/remotes/origin/&#42;),
775 but usually it is the name of a branch in the remote repository.</p></div>
776 <div class="paragraph"><p>Default values for &lt;repository&gt; and &lt;branch&gt; are read from the
777 "remote" and "merge" configuration for the current branch
778 as set by <a href="git-branch.html">git-branch(1)</a> <code>--track</code>.</p></div>
779 <div class="paragraph"><p>Assume the following history exists and the current branch is
780 "<code>master</code>":</p></div>
781 <div class="listingblock">
782 <div class="content">
783 <pre><code> A---B---C master on origin
785 D---E---F---G master
787 origin/master in your repository</code></pre>
788 </div></div>
789 <div class="paragraph"><p>Then "<code>git pull</code>" will fetch and replay the changes from the remote
790 <code>master</code> branch since it diverged from the local <code>master</code> (i.e., <code>E</code>)
791 until its current commit (<code>C</code>) on top of <code>master</code> and record the
792 result in a new commit along with the names of the two parent commits
793 and a log message from the user describing the changes.</p></div>
794 <div class="listingblock">
795 <div class="content">
796 <pre><code> A---B---C origin/master
798 D---E---F---G---H master</code></pre>
799 </div></div>
800 <div class="paragraph"><p>See <a href="git-merge.html">git-merge(1)</a> for details, including how conflicts
801 are presented and handled.</p></div>
802 <div class="paragraph"><p>In Git 1.7.0 or later, to cancel a conflicting merge, use
803 <code>git reset --merge</code>. <strong>Warning</strong>: In older versions of Git, running <em>git pull</em>
804 with uncommitted changes is discouraged: while possible, it leaves you
805 in a state that may be hard to back out of in the case of a conflict.</p></div>
806 <div class="paragraph"><p>If any of the remote changes overlap with local uncommitted changes,
807 the merge will be automatically canceled and the work tree untouched.
808 It is generally best to get any local changes in working order before
809 pulling or stash them away with <a href="git-stash.html">git-stash(1)</a>.</p></div>
810 </div>
811 </div>
812 <div class="sect1">
813 <h2 id="_options">OPTIONS</h2>
814 <div class="sectionbody">
815 <div class="dlist"><dl>
816 <dt class="hdlist1">
818 </dt>
819 <dt class="hdlist1">
820 --quiet
821 </dt>
822 <dd>
824 This is passed to both underlying git-fetch to squelch reporting of
825 during transfer, and underlying git-merge to squelch output during
826 merging.
827 </p>
828 </dd>
829 <dt class="hdlist1">
831 </dt>
832 <dt class="hdlist1">
833 --verbose
834 </dt>
835 <dd>
837 Pass --verbose to git-fetch and git-merge.
838 </p>
839 </dd>
840 <dt class="hdlist1">
841 --[no-]recurse-submodules[=yes|on-demand|no]
842 </dt>
843 <dd>
845 This option controls if new commits of populated submodules should
846 be fetched, and if the working trees of active submodules should be
847 updated, too (see <a href="git-fetch.html">git-fetch(1)</a>, <a href="git-config.html">git-config(1)</a> and
848 <a href="gitmodules.html">gitmodules(5)</a>).
849 </p>
850 <div class="paragraph"><p>If the checkout is done via rebase, local submodule commits are rebased as well.</p></div>
851 <div class="paragraph"><p>If the update is done via merge, the submodule conflicts are resolved and checked out.</p></div>
852 </dd>
853 </dl></div>
854 <div class="sect2">
855 <h3 id="_options_related_to_merging">Options related to merging</h3>
856 <div class="dlist"><dl>
857 <dt class="hdlist1">
858 --commit
859 </dt>
860 <dt class="hdlist1">
861 --no-commit
862 </dt>
863 <dd>
865 Perform the merge and commit the result. This option can
866 be used to override --no-commit.
867 Only useful when merging.
868 </p>
869 <div class="paragraph"><p>With --no-commit perform the merge and stop just before creating
870 a merge commit, to give the user a chance to inspect and further
871 tweak the merge result before committing.</p></div>
872 <div class="paragraph"><p>Note that fast-forward updates do not create a merge commit and
873 therefore there is no way to stop those merges with --no-commit.
874 Thus, if you want to ensure your branch is not changed or updated
875 by the merge command, use --no-ff with --no-commit.</p></div>
876 </dd>
877 <dt class="hdlist1">
878 --edit
879 </dt>
880 <dt class="hdlist1">
882 </dt>
883 <dt class="hdlist1">
884 --no-edit
885 </dt>
886 <dd>
888 Invoke an editor before committing successful mechanical merge to
889 further edit the auto-generated merge message, so that the user
890 can explain and justify the merge. The <code>--no-edit</code> option can be
891 used to accept the auto-generated message (this is generally
892 discouraged).
893 </p>
894 <div class="paragraph"><p>Older scripts may depend on the historical behaviour of not allowing the
895 user to edit the merge log message. They will see an editor opened when
896 they run <code>git merge</code>. To make it easier to adjust such scripts to the
897 updated behaviour, the environment variable <code>GIT_MERGE_AUTOEDIT</code> can be
898 set to <code>no</code> at the beginning of them.</p></div>
899 </dd>
900 <dt class="hdlist1">
901 --cleanup=&lt;mode&gt;
902 </dt>
903 <dd>
905 This option determines how the merge message will be cleaned up before
906 committing. See <a href="git-commit.html">git-commit(1)</a> for more details. In addition, if
907 the <em>&lt;mode&gt;</em> is given a value of <code>scissors</code>, scissors will be appended
908 to <code>MERGE_MSG</code> before being passed on to the commit machinery in the
909 case of a merge conflict.
910 </p>
911 </dd>
912 <dt class="hdlist1">
913 --ff-only
914 </dt>
915 <dd>
917 Only update to the new history if there is no divergent local
918 history. This is the default when no method for reconciling
919 divergent histories is provided (via the --rebase=* flags).
920 </p>
921 </dd>
922 <dt class="hdlist1">
923 --ff
924 </dt>
925 <dt class="hdlist1">
926 --no-ff
927 </dt>
928 <dd>
930 When merging rather than rebasing, specifies how a merge is
931 handled when the merged-in history is already a descendant of
932 the current history. If merging is requested, <code>--ff</code> is the
933 default unless merging an annotated (and possibly signed) tag
934 that is not stored in its natural place in the <code>refs/tags/</code>
935 hierarchy, in which case <code>--no-ff</code> is assumed.
936 </p>
937 <div class="paragraph"><p>With <code>--ff</code>, when possible resolve the merge as a fast-forward (only
938 update the branch pointer to match the merged branch; do not create a
939 merge commit). When not possible (when the merged-in history is not a
940 descendant of the current history), create a merge commit.</p></div>
941 <div class="paragraph"><p>With <code>--no-ff</code>, create a merge commit in all cases, even when the merge
942 could instead be resolved as a fast-forward.</p></div>
943 </dd>
944 <dt class="hdlist1">
945 -S[&lt;keyid&gt;]
946 </dt>
947 <dt class="hdlist1">
948 --gpg-sign[=&lt;keyid&gt;]
949 </dt>
950 <dt class="hdlist1">
951 --no-gpg-sign
952 </dt>
953 <dd>
955 GPG-sign the resulting merge commit. The <code>keyid</code> argument is
956 optional and defaults to the committer identity; if specified,
957 it must be stuck to the option without a space. <code>--no-gpg-sign</code>
958 is useful to countermand both <code>commit.gpgSign</code> configuration variable,
959 and earlier <code>--gpg-sign</code>.
960 </p>
961 </dd>
962 <dt class="hdlist1">
963 --log[=&lt;n&gt;]
964 </dt>
965 <dt class="hdlist1">
966 --no-log
967 </dt>
968 <dd>
970 In addition to branch names, populate the log message with
971 one-line descriptions from at most &lt;n&gt; actual commits that are being
972 merged. See also <a href="git-fmt-merge-msg.html">git-fmt-merge-msg(1)</a>.
973 Only useful when merging.
974 </p>
975 <div class="paragraph"><p>With --no-log do not list one-line descriptions from the
976 actual commits being merged.</p></div>
977 </dd>
978 <dt class="hdlist1">
979 --signoff
980 </dt>
981 <dt class="hdlist1">
982 --no-signoff
983 </dt>
984 <dd>
986 Add a <code>Signed-off-by</code> trailer by the committer at the end of the commit
987 log message. The meaning of a signoff depends on the project
988 to which you&#8217;re committing. For example, it may certify that
989 the committer has the rights to submit the work under the
990 project&#8217;s license or agrees to some contributor representation,
991 such as a Developer Certificate of Origin.
992 (See <a href="http://developercertificate.org">http://developercertificate.org</a> for the one used by the
993 Linux kernel and Git projects.) Consult the documentation or
994 leadership of the project to which you&#8217;re contributing to
995 understand how the signoffs are used in that project.
996 </p>
997 <div class="paragraph"><p>The --no-signoff option can be used to countermand an earlier --signoff
998 option on the command line.</p></div>
999 </dd>
1000 <dt class="hdlist1">
1001 --stat
1002 </dt>
1003 <dt class="hdlist1">
1005 </dt>
1006 <dt class="hdlist1">
1007 --no-stat
1008 </dt>
1009 <dd>
1011 Show a diffstat at the end of the merge. The diffstat is also
1012 controlled by the configuration option merge.stat.
1013 </p>
1014 <div class="paragraph"><p>With -n or --no-stat do not show a diffstat at the end of the
1015 merge.</p></div>
1016 </dd>
1017 <dt class="hdlist1">
1018 --squash
1019 </dt>
1020 <dt class="hdlist1">
1021 --no-squash
1022 </dt>
1023 <dd>
1025 Produce the working tree and index state as if a real merge
1026 happened (except for the merge information), but do not actually
1027 make a commit, move the <code>HEAD</code>, or record <code>$GIT_DIR/MERGE_HEAD</code>
1028 (to cause the next <code>git commit</code> command to create a merge
1029 commit). This allows you to create a single commit on top of
1030 the current branch whose effect is the same as merging another
1031 branch (or more in case of an octopus).
1032 </p>
1033 <div class="paragraph"><p>With --no-squash perform the merge and commit the result. This
1034 option can be used to override --squash.</p></div>
1035 <div class="paragraph"><p>With --squash, --commit is not allowed, and will fail.</p></div>
1036 <div class="paragraph"><p>Only useful when merging.</p></div>
1037 </dd>
1038 <dt class="hdlist1">
1039 --[no-]verify
1040 </dt>
1041 <dd>
1043 By default, the pre-merge and commit-msg hooks are run.
1044 When <code>--no-verify</code> is given, these are bypassed.
1045 See also <a href="githooks.html">githooks(5)</a>.
1046 Only useful when merging.
1047 </p>
1048 </dd>
1049 <dt class="hdlist1">
1050 -s &lt;strategy&gt;
1051 </dt>
1052 <dt class="hdlist1">
1053 --strategy=&lt;strategy&gt;
1054 </dt>
1055 <dd>
1057 Use the given merge strategy; can be supplied more than
1058 once to specify them in the order they should be tried.
1059 If there is no <code>-s</code> option, a built-in list of strategies
1060 is used instead (<code>ort</code> when merging a single head,
1061 <code>octopus</code> otherwise).
1062 </p>
1063 </dd>
1064 <dt class="hdlist1">
1065 -X &lt;option&gt;
1066 </dt>
1067 <dt class="hdlist1">
1068 --strategy-option=&lt;option&gt;
1069 </dt>
1070 <dd>
1072 Pass merge strategy specific option through to the merge
1073 strategy.
1074 </p>
1075 </dd>
1076 <dt class="hdlist1">
1077 --verify-signatures
1078 </dt>
1079 <dt class="hdlist1">
1080 --no-verify-signatures
1081 </dt>
1082 <dd>
1084 Verify that the tip commit of the side branch being merged is
1085 signed with a valid key, i.e. a key that has a valid uid: in the
1086 default trust model, this means the signing key has been signed by
1087 a trusted key. If the tip commit of the side branch is not signed
1088 with a valid key, the merge is aborted.
1089 </p>
1090 <div class="paragraph"><p>Only useful when merging.</p></div>
1091 </dd>
1092 <dt class="hdlist1">
1093 --summary
1094 </dt>
1095 <dt class="hdlist1">
1096 --no-summary
1097 </dt>
1098 <dd>
1100 Synonyms to --stat and --no-stat; these are deprecated and will be
1101 removed in the future.
1102 </p>
1103 </dd>
1104 <dt class="hdlist1">
1105 --autostash
1106 </dt>
1107 <dt class="hdlist1">
1108 --no-autostash
1109 </dt>
1110 <dd>
1112 Automatically create a temporary stash entry before the operation
1113 begins, record it in the special ref <code>MERGE_AUTOSTASH</code>
1114 and apply it after the operation ends. This means
1115 that you can run the operation on a dirty worktree. However, use
1116 with care: the final stash application after a successful
1117 merge might result in non-trivial conflicts.
1118 </p>
1119 </dd>
1120 <dt class="hdlist1">
1121 --allow-unrelated-histories
1122 </dt>
1123 <dd>
1125 By default, <code>git merge</code> command refuses to merge histories
1126 that do not share a common ancestor. This option can be
1127 used to override this safety when merging histories of two
1128 projects that started their lives independently. As that is
1129 a very rare occasion, no configuration variable to enable
1130 this by default exists and will not be added.
1131 </p>
1132 <div class="paragraph"><p>Only useful when merging.</p></div>
1133 </dd>
1134 <dt class="hdlist1">
1136 </dt>
1137 <dt class="hdlist1">
1138 --rebase[=false|true|merges|interactive]
1139 </dt>
1140 <dd>
1142 When true, rebase the current branch on top of the upstream
1143 branch after fetching. If there is a remote-tracking branch
1144 corresponding to the upstream branch and the upstream branch
1145 was rebased since last fetched, the rebase uses that information
1146 to avoid rebasing non-local changes.
1147 </p>
1148 <div class="paragraph"><p>When set to <code>merges</code>, rebase using <code>git rebase --rebase-merges</code> so that
1149 the local merge commits are included in the rebase (see
1150 <a href="git-rebase.html">git-rebase(1)</a> for details).</p></div>
1151 <div class="paragraph"><p>When false, merge the upstream branch into the current branch.</p></div>
1152 <div class="paragraph"><p>When <code>interactive</code>, enable the interactive mode of rebase.</p></div>
1153 <div class="paragraph"><p>See <code>pull.rebase</code>, <code>branch.&lt;name&gt;.rebase</code> and <code>branch.autoSetupRebase</code> in
1154 <a href="git-config.html">git-config(1)</a> if you want to make <code>git pull</code> always use
1155 <code>--rebase</code> instead of merging.</p></div>
1156 <div class="admonitionblock">
1157 <table><tr>
1158 <td class="icon">
1159 <div class="title">Note</div>
1160 </td>
1161 <td class="content">This is a potentially <em>dangerous</em> mode of operation.
1162 It rewrites history, which does not bode well when you
1163 published that history already. Do <strong>not</strong> use this option
1164 unless you have read <a href="git-rebase.html">git-rebase(1)</a> carefully.</td>
1165 </tr></table>
1166 </div>
1167 </dd>
1168 <dt class="hdlist1">
1169 --no-rebase
1170 </dt>
1171 <dd>
1173 This is shorthand for --rebase=false.
1174 </p>
1175 </dd>
1176 </dl></div>
1177 </div>
1178 <div class="sect2">
1179 <h3 id="_options_related_to_fetching">Options related to fetching</h3>
1180 <div class="dlist"><dl>
1181 <dt class="hdlist1">
1182 --all
1183 </dt>
1184 <dd>
1186 Fetch all remotes.
1187 </p>
1188 </dd>
1189 <dt class="hdlist1">
1191 </dt>
1192 <dt class="hdlist1">
1193 --append
1194 </dt>
1195 <dd>
1197 Append ref names and object names of fetched refs to the
1198 existing contents of <code>.git/FETCH_HEAD</code>. Without this
1199 option old data in <code>.git/FETCH_HEAD</code> will be overwritten.
1200 </p>
1201 </dd>
1202 <dt class="hdlist1">
1203 --atomic
1204 </dt>
1205 <dd>
1207 Use an atomic transaction to update local refs. Either all refs are
1208 updated, or on error, no refs are updated.
1209 </p>
1210 </dd>
1211 <dt class="hdlist1">
1212 --depth=&lt;depth&gt;
1213 </dt>
1214 <dd>
1216 Limit fetching to the specified number of commits from the tip of
1217 each remote branch history. If fetching to a <em>shallow</em> repository
1218 created by <code>git clone</code> with <code>--depth=&lt;depth&gt;</code> option (see
1219 <a href="git-clone.html">git-clone(1)</a>), deepen or shorten the history to the specified
1220 number of commits. Tags for the deepened commits are not fetched.
1221 </p>
1222 </dd>
1223 <dt class="hdlist1">
1224 --deepen=&lt;depth&gt;
1225 </dt>
1226 <dd>
1228 Similar to --depth, except it specifies the number of commits
1229 from the current shallow boundary instead of from the tip of
1230 each remote branch history.
1231 </p>
1232 </dd>
1233 <dt class="hdlist1">
1234 --shallow-since=&lt;date&gt;
1235 </dt>
1236 <dd>
1238 Deepen or shorten the history of a shallow repository to
1239 include all reachable commits after &lt;date&gt;.
1240 </p>
1241 </dd>
1242 <dt class="hdlist1">
1243 --shallow-exclude=&lt;revision&gt;
1244 </dt>
1245 <dd>
1247 Deepen or shorten the history of a shallow repository to
1248 exclude commits reachable from a specified remote branch or tag.
1249 This option can be specified multiple times.
1250 </p>
1251 </dd>
1252 <dt class="hdlist1">
1253 --unshallow
1254 </dt>
1255 <dd>
1257 If the source repository is complete, convert a shallow
1258 repository to a complete one, removing all the limitations
1259 imposed by shallow repositories.
1260 </p>
1261 <div class="paragraph"><p>If the source repository is shallow, fetch as much as possible so that
1262 the current repository has the same history as the source repository.</p></div>
1263 </dd>
1264 <dt class="hdlist1">
1265 --update-shallow
1266 </dt>
1267 <dd>
1269 By default when fetching from a shallow repository,
1270 <code>git fetch</code> refuses refs that require updating
1271 .git/shallow. This option updates .git/shallow and accept such
1272 refs.
1273 </p>
1274 </dd>
1275 <dt class="hdlist1">
1276 --negotiation-tip=&lt;commit|glob&gt;
1277 </dt>
1278 <dd>
1280 By default, Git will report, to the server, commits reachable
1281 from all local refs to find common commits in an attempt to
1282 reduce the size of the to-be-received packfile. If specified,
1283 Git will only report commits reachable from the given tips.
1284 This is useful to speed up fetches when the user knows which
1285 local ref is likely to have commits in common with the
1286 upstream ref being fetched.
1287 </p>
1288 <div class="paragraph"><p>This option may be specified more than once; if so, Git will report
1289 commits reachable from any of the given commits.</p></div>
1290 <div class="paragraph"><p>The argument to this option may be a glob on ref names, a ref, or the (possibly
1291 abbreviated) SHA-1 of a commit. Specifying a glob is equivalent to specifying
1292 this option multiple times, one for each matching ref name.</p></div>
1293 <div class="paragraph"><p>See also the <code>fetch.negotiationAlgorithm</code> and <code>push.negotiate</code>
1294 configuration variables documented in <a href="git-config.html">git-config(1)</a>, and the
1295 <code>--negotiate-only</code> option below.</p></div>
1296 </dd>
1297 <dt class="hdlist1">
1298 --negotiate-only
1299 </dt>
1300 <dd>
1302 Do not fetch anything from the server, and instead print the
1303 ancestors of the provided <code>--negotiation-tip=*</code> arguments,
1304 which we have in common with the server.
1305 </p>
1306 <div class="paragraph"><p>This is incompatible with <code>--recurse-submodules=[yes|on-demand]</code>.
1307 Internally this is used to implement the <code>push.negotiate</code> option, see
1308 <a href="git-config.html">git-config(1)</a>.</p></div>
1309 </dd>
1310 <dt class="hdlist1">
1311 --dry-run
1312 </dt>
1313 <dd>
1315 Show what would be done, without making any changes.
1316 </p>
1317 </dd>
1318 <dt class="hdlist1">
1319 --porcelain
1320 </dt>
1321 <dd>
1323 Print the output to standard output in an easy-to-parse format for
1324 scripts. See section OUTPUT in <a href="git-fetch.html">git-fetch(1)</a> for details.
1325 </p>
1326 <div class="paragraph"><p>This is incompatible with <code>--recurse-submodules=[yes|on-demand]</code> and takes
1327 precedence over the <code>fetch.output</code> config option.</p></div>
1328 </dd>
1329 <dt class="hdlist1">
1331 </dt>
1332 <dt class="hdlist1">
1333 --force
1334 </dt>
1335 <dd>
1337 When <em>git fetch</em> is used with <code>&lt;src&gt;:&lt;dst&gt;</code> refspec it may
1338 refuse to update the local branch as discussed
1339 in the <code>&lt;refspec&gt;</code> part of the <a href="git-fetch.html">git-fetch(1)</a>
1340 documentation.
1341 This option overrides that check.
1342 </p>
1343 </dd>
1344 <dt class="hdlist1">
1346 </dt>
1347 <dt class="hdlist1">
1348 --keep
1349 </dt>
1350 <dd>
1352 Keep downloaded pack.
1353 </p>
1354 </dd>
1355 <dt class="hdlist1">
1356 --prefetch
1357 </dt>
1358 <dd>
1360 Modify the configured refspec to place all refs into the
1361 <code>refs/prefetch/</code> namespace. See the <code>prefetch</code> task in
1362 <a href="git-maintenance.html">git-maintenance(1)</a>.
1363 </p>
1364 </dd>
1365 <dt class="hdlist1">
1367 </dt>
1368 <dt class="hdlist1">
1369 --prune
1370 </dt>
1371 <dd>
1373 Before fetching, remove any remote-tracking references that no
1374 longer exist on the remote. Tags are not subject to pruning
1375 if they are fetched only because of the default tag
1376 auto-following or due to a --tags option. However, if tags
1377 are fetched due to an explicit refspec (either on the command
1378 line or in the remote configuration, for example if the remote
1379 was cloned with the --mirror option), then they are also
1380 subject to pruning. Supplying <code>--prune-tags</code> is a shorthand for
1381 providing the tag refspec.
1382 </p>
1383 </dd>
1384 <dt class="hdlist1">
1385 --no-tags
1386 </dt>
1387 <dd>
1389 By default, tags that point at objects that are downloaded
1390 from the remote repository are fetched and stored locally.
1391 This option disables this automatic tag following. The default
1392 behavior for a remote may be specified with the remote.&lt;name&gt;.tagOpt
1393 setting. See <a href="git-config.html">git-config(1)</a>.
1394 </p>
1395 </dd>
1396 <dt class="hdlist1">
1397 --refmap=&lt;refspec&gt;
1398 </dt>
1399 <dd>
1401 When fetching refs listed on the command line, use the
1402 specified refspec (can be given more than once) to map the
1403 refs to remote-tracking branches, instead of the values of
1404 <code>remote.*.fetch</code> configuration variables for the remote
1405 repository. Providing an empty <code>&lt;refspec&gt;</code> to the
1406 <code>--refmap</code> option causes Git to ignore the configured
1407 refspecs and rely entirely on the refspecs supplied as
1408 command-line arguments. See section on "Configured Remote-tracking
1409 Branches" for details.
1410 </p>
1411 </dd>
1412 <dt class="hdlist1">
1414 </dt>
1415 <dt class="hdlist1">
1416 --tags
1417 </dt>
1418 <dd>
1420 Fetch all tags from the remote (i.e., fetch remote tags
1421 <code>refs/tags/*</code> into local tags with the same name), in addition
1422 to whatever else would otherwise be fetched. Using this
1423 option alone does not subject tags to pruning, even if --prune
1424 is used (though tags may be pruned anyway if they are also the
1425 destination of an explicit refspec; see <code>--prune</code>).
1426 </p>
1427 </dd>
1428 <dt class="hdlist1">
1430 </dt>
1431 <dt class="hdlist1">
1432 --jobs=&lt;n&gt;
1433 </dt>
1434 <dd>
1436 Number of parallel children to be used for all forms of fetching.
1437 </p>
1438 <div class="paragraph"><p>If the <code>--multiple</code> option was specified, the different remotes will be fetched
1439 in parallel. If multiple submodules are fetched, they will be fetched in
1440 parallel. To control them independently, use the config settings
1441 <code>fetch.parallel</code> and <code>submodule.fetchJobs</code> (see <a href="git-config.html">git-config(1)</a>).</p></div>
1442 <div class="paragraph"><p>Typically, parallel recursive and multi-remote fetches will be faster. By
1443 default fetches are performed sequentially, not in parallel.</p></div>
1444 </dd>
1445 <dt class="hdlist1">
1446 --set-upstream
1447 </dt>
1448 <dd>
1450 If the remote is fetched successfully, add upstream
1451 (tracking) reference, used by argument-less
1452 <a href="git-pull.html">git-pull(1)</a> and other commands. For more information,
1453 see <code>branch.&lt;name&gt;.merge</code> and <code>branch.&lt;name&gt;.remote</code> in
1454 <a href="git-config.html">git-config(1)</a>.
1455 </p>
1456 </dd>
1457 <dt class="hdlist1">
1458 --upload-pack &lt;upload-pack&gt;
1459 </dt>
1460 <dd>
1462 When given, and the repository to fetch from is handled
1463 by <em>git fetch-pack</em>, <code>--exec=&lt;upload-pack&gt;</code> is passed to
1464 the command to specify non-default path for the command
1465 run on the other end.
1466 </p>
1467 </dd>
1468 <dt class="hdlist1">
1469 --progress
1470 </dt>
1471 <dd>
1473 Progress status is reported on the standard error stream
1474 by default when it is attached to a terminal, unless -q
1475 is specified. This flag forces progress status even if the
1476 standard error stream is not directed to a terminal.
1477 </p>
1478 </dd>
1479 <dt class="hdlist1">
1480 -o &lt;option&gt;
1481 </dt>
1482 <dt class="hdlist1">
1483 --server-option=&lt;option&gt;
1484 </dt>
1485 <dd>
1487 Transmit the given string to the server when communicating using
1488 protocol version 2. The given string must not contain a NUL or LF
1489 character. The server&#8217;s handling of server options, including
1490 unknown ones, is server-specific.
1491 When multiple <code>--server-option=&lt;option&gt;</code> are given, they are all
1492 sent to the other side in the order listed on the command line.
1493 </p>
1494 </dd>
1495 <dt class="hdlist1">
1496 --show-forced-updates
1497 </dt>
1498 <dd>
1500 By default, git checks if a branch is force-updated during
1501 fetch. This can be disabled through fetch.showForcedUpdates, but
1502 the --show-forced-updates option guarantees this check occurs.
1503 See <a href="git-config.html">git-config(1)</a>.
1504 </p>
1505 </dd>
1506 <dt class="hdlist1">
1507 --no-show-forced-updates
1508 </dt>
1509 <dd>
1511 By default, git checks if a branch is force-updated during
1512 fetch. Pass --no-show-forced-updates or set fetch.showForcedUpdates
1513 to false to skip this check for performance reasons. If used during
1514 <em>git-pull</em> the --ff-only option will still check for forced updates
1515 before attempting a fast-forward update. See <a href="git-config.html">git-config(1)</a>.
1516 </p>
1517 </dd>
1518 <dt class="hdlist1">
1520 </dt>
1521 <dt class="hdlist1">
1522 --ipv4
1523 </dt>
1524 <dd>
1526 Use IPv4 addresses only, ignoring IPv6 addresses.
1527 </p>
1528 </dd>
1529 <dt class="hdlist1">
1531 </dt>
1532 <dt class="hdlist1">
1533 --ipv6
1534 </dt>
1535 <dd>
1537 Use IPv6 addresses only, ignoring IPv4 addresses.
1538 </p>
1539 </dd>
1540 <dt class="hdlist1">
1541 &lt;repository&gt;
1542 </dt>
1543 <dd>
1545 The "remote" repository that is the source of a fetch
1546 or pull operation. This parameter can be either a URL
1547 (see the section <a href="#URLS">GIT URLS</a> below) or the name
1548 of a remote (see the section <a href="#REMOTES">REMOTES</a> below).
1549 </p>
1550 </dd>
1551 <dt class="hdlist1">
1552 &lt;refspec&gt;
1553 </dt>
1554 <dd>
1556 Specifies which refs to fetch and which local refs to update.
1557 When no &lt;refspec&gt;s appear on the command line, the refs to fetch
1558 are read from <code>remote.&lt;repository&gt;.fetch</code> variables instead
1559 (see the section "CONFIGURED REMOTE-TRACKING BRANCHES"
1560 in <a href="git-fetch.html">git-fetch(1)</a>).
1561 </p>
1562 <div class="paragraph"><p>The format of a &lt;refspec&gt; parameter is an optional plus
1563 <code>+</code>, followed by the source &lt;src&gt;, followed
1564 by a colon <code>:</code>, followed by the destination ref &lt;dst&gt;.
1565 The colon can be omitted when &lt;dst&gt; is empty. &lt;src&gt; is
1566 typically a ref, but it can also be a fully spelled hex object
1567 name.</p></div>
1568 <div class="paragraph"><p>A &lt;refspec&gt; may contain a <code>*</code> in its &lt;src&gt; to indicate a simple pattern
1569 match. Such a refspec functions like a glob that matches any ref with the
1570 same prefix. A pattern &lt;refspec&gt; must have a <code>*</code> in both the &lt;src&gt; and
1571 &lt;dst&gt;. It will map refs to the destination by replacing the <code>*</code> with the
1572 contents matched from the source.</p></div>
1573 <div class="paragraph"><p>If a refspec is prefixed by <code>^</code>, it will be interpreted as a negative
1574 refspec. Rather than specifying which refs to fetch or which local refs to
1575 update, such a refspec will instead specify refs to exclude. A ref will be
1576 considered to match if it matches at least one positive refspec, and does
1577 not match any negative refspec. Negative refspecs can be useful to restrict
1578 the scope of a pattern refspec so that it will not include specific refs.
1579 Negative refspecs can themselves be pattern refspecs. However, they may only
1580 contain a &lt;src&gt; and do not specify a &lt;dst&gt;. Fully spelled out hex object
1581 names are also not supported.</p></div>
1582 <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>;
1583 it requests fetching everything up to the given tag.</p></div>
1584 <div class="paragraph"><p>The remote ref that matches &lt;src&gt;
1585 is fetched, and if &lt;dst&gt; is not an empty string, an attempt
1586 is made to update the local ref that matches it.</p></div>
1587 <div class="paragraph"><p>Whether that update is allowed without <code>--force</code> depends on the ref
1588 namespace it&#8217;s being fetched to, the type of object being fetched, and
1589 whether the update is considered to be a fast-forward. Generally, the
1590 same rules apply for fetching as when pushing, see the <code>&lt;refspec&gt;...</code>
1591 section of <a href="git-push.html">git-push(1)</a> for what those are. Exceptions to those
1592 rules particular to <em>git fetch</em> are noted below.</p></div>
1593 <div class="paragraph"><p>Until Git version 2.20, and unlike when pushing with
1594 <a href="git-push.html">git-push(1)</a>, any updates to <code>refs/tags/*</code> would be accepted
1595 without <code>+</code> in the refspec (or <code>--force</code>). When fetching, we promiscuously
1596 considered all tag updates from a remote to be forced fetches. Since
1597 Git version 2.20, fetching to update <code>refs/tags/*</code> works the same way
1598 as when pushing. I.e. any updates will be rejected without <code>+</code> in the
1599 refspec (or <code>--force</code>).</p></div>
1600 <div class="paragraph"><p>Unlike when pushing with <a href="git-push.html">git-push(1)</a>, any updates outside of
1601 <code>refs/{tags,heads}/*</code> will be accepted without <code>+</code> in the refspec (or
1602 <code>--force</code>), whether that&#8217;s swapping e.g. a tree object for a blob, or
1603 a commit for another commit that&#8217;s doesn&#8217;t have the previous commit as
1604 an ancestor etc.</p></div>
1605 <div class="paragraph"><p>Unlike when pushing with <a href="git-push.html">git-push(1)</a>, there is no
1606 configuration which&#8217;ll amend these rules, and nothing like a
1607 <code>pre-fetch</code> hook analogous to the <code>pre-receive</code> hook.</p></div>
1608 <div class="paragraph"><p>As with pushing with <a href="git-push.html">git-push(1)</a>, all of the rules described
1609 above about what&#8217;s not allowed as an update can be overridden by
1610 adding an the optional leading <code>+</code> to a refspec (or using <code>--force</code>
1611 command line option). The only exception to this is that no amount of
1612 forcing will make the <code>refs/heads/*</code> namespace accept a non-commit
1613 object.</p></div>
1614 <div class="admonitionblock">
1615 <table><tr>
1616 <td class="icon">
1617 <div class="title">Note</div>
1618 </td>
1619 <td class="content">When the remote branch you want to fetch is known to
1620 be rewound and rebased regularly, it is expected that
1621 its new tip will not be descendant of its previous tip
1622 (as stored in your remote-tracking branch the last time
1623 you fetched). You would want
1624 to use the <code>+</code> sign to indicate non-fast-forward updates
1625 will be needed for such branches. There is no way to
1626 determine or declare that a branch will be made available
1627 in a repository with this behavior; the pulling user simply
1628 must know this is the expected usage pattern for a branch.</td>
1629 </tr></table>
1630 </div>
1631 <div class="admonitionblock">
1632 <table><tr>
1633 <td class="icon">
1634 <div class="title">Note</div>
1635 </td>
1636 <td class="content">There is a difference between listing multiple &lt;refspec&gt;
1637 directly on <em>git pull</em> command line and having multiple
1638 <code>remote.&lt;repository&gt;.fetch</code> entries in your configuration
1639 for a &lt;repository&gt; and running a
1640 <em>git pull</em> command without any explicit &lt;refspec&gt; parameters.
1641 &lt;refspec&gt;s listed explicitly on the command line are always
1642 merged into the current branch after fetching. In other words,
1643 if you list more than one remote ref, <em>git pull</em> will create
1644 an Octopus merge. On the other hand, if you do not list any
1645 explicit &lt;refspec&gt; parameter on the command line, <em>git pull</em>
1646 will fetch all the &lt;refspec&gt;s it finds in the
1647 <code>remote.&lt;repository&gt;.fetch</code> configuration and merge
1648 only the first &lt;refspec&gt; found into the current branch.
1649 This is because making an
1650 Octopus from remote refs is rarely done, while keeping track
1651 of multiple remote heads in one-go by fetching more than one
1652 is often useful.</td>
1653 </tr></table>
1654 </div>
1655 </dd>
1656 </dl></div>
1657 </div>
1658 </div>
1659 </div>
1660 <div class="sect1">
1661 <h2 id="_git_urls_a_id_urls_a">GIT URLS<a id="URLS"></a></h2>
1662 <div class="sectionbody">
1663 <div class="paragraph"><p>In general, URLs contain information about the transport protocol, the
1664 address of the remote server, and the path to the repository.
1665 Depending on the transport protocol, some of this information may be
1666 absent.</p></div>
1667 <div class="paragraph"><p>Git supports ssh, git, http, and https protocols (in addition, ftp,
1668 and ftps can be used for fetching, but this is inefficient and
1669 deprecated; do not use it).</p></div>
1670 <div class="paragraph"><p>The native transport (i.e. git:// URL) does no authentication and
1671 should be used with caution on unsecured networks.</p></div>
1672 <div class="paragraph"><p>The following syntaxes may be used with them:</p></div>
1673 <div class="ulist"><ul>
1674 <li>
1676 ssh://&#91;user@&#93;host.xz&#91;:port&#93;/path/to/repo.git/
1677 </p>
1678 </li>
1679 <li>
1681 git://host.xz&#91;:port&#93;/path/to/repo.git/
1682 </p>
1683 </li>
1684 <li>
1686 http&#91;s&#93;://host.xz&#91;:port&#93;/path/to/repo.git/
1687 </p>
1688 </li>
1689 <li>
1691 ftp&#91;s&#93;://host.xz&#91;:port&#93;/path/to/repo.git/
1692 </p>
1693 </li>
1694 </ul></div>
1695 <div class="paragraph"><p>An alternative scp-like syntax may also be used with the ssh protocol:</p></div>
1696 <div class="ulist"><ul>
1697 <li>
1699 &#91;user@&#93;host.xz:path/to/repo.git/
1700 </p>
1701 </li>
1702 </ul></div>
1703 <div class="paragraph"><p>This syntax is only recognized if there are no slashes before the
1704 first colon. This helps differentiate a local path that contains a
1705 colon. For example the local path <code>foo:bar</code> could be specified as an
1706 absolute path or <code>./foo:bar</code> to avoid being misinterpreted as an ssh
1707 url.</p></div>
1708 <div class="paragraph"><p>The ssh and git protocols additionally support ~username expansion:</p></div>
1709 <div class="ulist"><ul>
1710 <li>
1712 ssh://&#91;user@&#93;host.xz&#91;:port&#93;/~&#91;user&#93;/path/to/repo.git/
1713 </p>
1714 </li>
1715 <li>
1717 git://host.xz&#91;:port&#93;/~&#91;user&#93;/path/to/repo.git/
1718 </p>
1719 </li>
1720 <li>
1722 &#91;user@&#93;host.xz:/~&#91;user&#93;/path/to/repo.git/
1723 </p>
1724 </li>
1725 </ul></div>
1726 <div class="paragraph"><p>For local repositories, also supported by Git natively, the following
1727 syntaxes may be used:</p></div>
1728 <div class="ulist"><ul>
1729 <li>
1731 /path/to/repo.git/
1732 </p>
1733 </li>
1734 <li>
1736 file:///path/to/repo.git/
1737 </p>
1738 </li>
1739 </ul></div>
1740 <div class="paragraph"><p>These two syntaxes are mostly equivalent, except when cloning, when
1741 the former implies --local option. See <a href="git-clone.html">git-clone(1)</a> for
1742 details.</p></div>
1743 <div class="paragraph"><p><em>git clone</em>, <em>git fetch</em> and <em>git pull</em>, but not <em>git push</em>, will also
1744 accept a suitable bundle file. See <a href="git-bundle.html">git-bundle(1)</a>.</p></div>
1745 <div class="paragraph"><p>When Git doesn&#8217;t know how to handle a certain transport protocol, it
1746 attempts to use the <em>remote-&lt;transport&gt;</em> remote helper, if one
1747 exists. To explicitly request a remote helper, the following syntax
1748 may be used:</p></div>
1749 <div class="ulist"><ul>
1750 <li>
1752 &lt;transport&gt;::&lt;address&gt;
1753 </p>
1754 </li>
1755 </ul></div>
1756 <div class="paragraph"><p>where &lt;address&gt; may be a path, a server and path, or an arbitrary
1757 URL-like string recognized by the specific remote helper being
1758 invoked. See <a href="gitremote-helpers.html">gitremote-helpers(7)</a> for details.</p></div>
1759 <div class="paragraph"><p>If there are a large number of similarly-named remote repositories and
1760 you want to use a different format for them (such that the URLs you
1761 use will be rewritten into URLs that work), you can create a
1762 configuration section of the form:</p></div>
1763 <div class="listingblock">
1764 <div class="content">
1765 <pre><code> [url "&lt;actual url base&gt;"]
1766 insteadOf = &lt;other url base&gt;</code></pre>
1767 </div></div>
1768 <div class="paragraph"><p>For example, with this:</p></div>
1769 <div class="listingblock">
1770 <div class="content">
1771 <pre><code> [url "git://git.host.xz/"]
1772 insteadOf = host.xz:/path/to/
1773 insteadOf = work:</code></pre>
1774 </div></div>
1775 <div class="paragraph"><p>a URL like "work:repo.git" or like "host.xz:/path/to/repo.git" will be
1776 rewritten in any context that takes a URL to be "git://git.host.xz/repo.git".</p></div>
1777 <div class="paragraph"><p>If you want to rewrite URLs for push only, you can create a
1778 configuration section of the form:</p></div>
1779 <div class="listingblock">
1780 <div class="content">
1781 <pre><code> [url "&lt;actual url base&gt;"]
1782 pushInsteadOf = &lt;other url base&gt;</code></pre>
1783 </div></div>
1784 <div class="paragraph"><p>For example, with this:</p></div>
1785 <div class="listingblock">
1786 <div class="content">
1787 <pre><code> [url "ssh://example.org/"]
1788 pushInsteadOf = git://example.org/</code></pre>
1789 </div></div>
1790 <div class="paragraph"><p>a URL like "git://example.org/path/to/repo.git" will be rewritten to
1791 "ssh://example.org/path/to/repo.git" for pushes, but pulls will still
1792 use the original URL.</p></div>
1793 </div>
1794 </div>
1795 <div class="sect1">
1796 <h2 id="_remotes_a_id_remotes_a">REMOTES<a id="REMOTES"></a></h2>
1797 <div class="sectionbody">
1798 <div class="paragraph"><p>The name of one of the following can be used instead
1799 of a URL as <code>&lt;repository&gt;</code> argument:</p></div>
1800 <div class="ulist"><ul>
1801 <li>
1803 a remote in the Git configuration file: <code>$GIT_DIR/config</code>,
1804 </p>
1805 </li>
1806 <li>
1808 a file in the <code>$GIT_DIR/remotes</code> directory, or
1809 </p>
1810 </li>
1811 <li>
1813 a file in the <code>$GIT_DIR/branches</code> directory.
1814 </p>
1815 </li>
1816 </ul></div>
1817 <div class="paragraph"><p>All of these also allow you to omit the refspec from the command line
1818 because they each contain a refspec which git will use by default.</p></div>
1819 <div class="sect2">
1820 <h3 id="_named_remote_in_configuration_file">Named remote in configuration file</h3>
1821 <div class="paragraph"><p>You can choose to provide the name of a remote which you had previously
1822 configured using <a href="git-remote.html">git-remote(1)</a>, <a href="git-config.html">git-config(1)</a>
1823 or even by a manual edit to the <code>$GIT_DIR/config</code> file. The URL of
1824 this remote will be used to access the repository. The refspec
1825 of this remote will be used by default when you do
1826 not provide a refspec on the command line. The entry in the
1827 config file would appear like this:</p></div>
1828 <div class="listingblock">
1829 <div class="content">
1830 <pre><code> [remote "&lt;name&gt;"]
1831 url = &lt;URL&gt;
1832 pushurl = &lt;pushurl&gt;
1833 push = &lt;refspec&gt;
1834 fetch = &lt;refspec&gt;</code></pre>
1835 </div></div>
1836 <div class="paragraph"><p>The <code>&lt;pushurl&gt;</code> is used for pushes only. It is optional and defaults
1837 to <code>&lt;URL&gt;</code>. Pushing to a remote affects all defined pushurls or to all
1838 defined urls if no pushurls are defined. Fetch, however, will only
1839 fetch from the first defined url if multiple urls are defined.</p></div>
1840 </div>
1841 <div class="sect2">
1842 <h3 id="_named_file_in_code_git_dir_remotes_code">Named file in <code>$GIT_DIR/remotes</code></h3>
1843 <div class="paragraph"><p>You can choose to provide the name of a
1844 file in <code>$GIT_DIR/remotes</code>. The URL
1845 in this file will be used to access the repository. The refspec
1846 in this file will be used as default when you do not
1847 provide a refspec on the command line. This file should have the
1848 following format:</p></div>
1849 <div class="listingblock">
1850 <div class="content">
1851 <pre><code> URL: one of the above URL format
1852 Push: &lt;refspec&gt;
1853 Pull: &lt;refspec&gt;</code></pre>
1854 </div></div>
1855 <div class="paragraph"><p><code>Push:</code> lines are used by <em>git push</em> and
1856 <code>Pull:</code> lines are used by <em>git pull</em> and <em>git fetch</em>.
1857 Multiple <code>Push:</code> and <code>Pull:</code> lines may
1858 be specified for additional branch mappings.</p></div>
1859 </div>
1860 <div class="sect2">
1861 <h3 id="_named_file_in_code_git_dir_branches_code">Named file in <code>$GIT_DIR/branches</code></h3>
1862 <div class="paragraph"><p>You can choose to provide the name of a
1863 file in <code>$GIT_DIR/branches</code>.
1864 The URL in this file will be used to access the repository.
1865 This file should have the following format:</p></div>
1866 <div class="listingblock">
1867 <div class="content">
1868 <pre><code> &lt;URL&gt;#&lt;head&gt;</code></pre>
1869 </div></div>
1870 <div class="paragraph"><p><code>&lt;URL&gt;</code> is required; <code>#&lt;head&gt;</code> is optional.</p></div>
1871 <div class="paragraph"><p>Depending on the operation, git will use one of the following
1872 refspecs, if you don&#8217;t provide one on the command line.
1873 <code>&lt;branch&gt;</code> is the name of this file in <code>$GIT_DIR/branches</code> and
1874 <code>&lt;head&gt;</code> defaults to <code>master</code>.</p></div>
1875 <div class="paragraph"><p>git fetch uses:</p></div>
1876 <div class="listingblock">
1877 <div class="content">
1878 <pre><code> refs/heads/&lt;head&gt;:refs/heads/&lt;branch&gt;</code></pre>
1879 </div></div>
1880 <div class="paragraph"><p>git push uses:</p></div>
1881 <div class="listingblock">
1882 <div class="content">
1883 <pre><code> HEAD:refs/heads/&lt;head&gt;</code></pre>
1884 </div></div>
1885 </div>
1886 </div>
1887 </div>
1888 <div class="sect1">
1889 <h2 id="_merge_strategies">MERGE STRATEGIES</h2>
1890 <div class="sectionbody">
1891 <div class="paragraph"><p>The merge mechanism (<code>git merge</code> and <code>git pull</code> commands) allows the
1892 backend <em>merge strategies</em> to be chosen with <code>-s</code> option. Some strategies
1893 can also take their own options, which can be passed by giving <code>-X&lt;option&gt;</code>
1894 arguments to <code>git merge</code> and/or <code>git pull</code>.</p></div>
1895 <div class="dlist"><dl>
1896 <dt class="hdlist1">
1898 </dt>
1899 <dd>
1901 This is the default merge strategy when pulling or merging one
1902 branch. This strategy can only resolve two heads using a
1903 3-way merge algorithm. When there is more than one common
1904 ancestor that can be used for 3-way merge, it creates a merged
1905 tree of the common ancestors and uses that as the reference
1906 tree for the 3-way merge. This has been reported to result in
1907 fewer merge conflicts without causing mismerges by tests done
1908 on actual merge commits taken from Linux 2.6 kernel
1909 development history. Additionally this strategy can detect
1910 and handle merges involving renames. It does not make use of
1911 detected copies. The name for this algorithm is an acronym
1912 ("Ostensibly Recursive&#8217;s Twin") and came from the fact that it
1913 was written as a replacement for the previous default
1914 algorithm, <code>recursive</code>.
1915 </p>
1916 <div class="paragraph"><p>The <em>ort</em> strategy can take the following options:</p></div>
1917 <div class="dlist"><dl>
1918 <dt class="hdlist1">
1919 ours
1920 </dt>
1921 <dd>
1923 This option forces conflicting hunks to be auto-resolved cleanly by
1924 favoring <em>our</em> version. Changes from the other tree that do not
1925 conflict with our side are reflected in the merge result.
1926 For a binary file, the entire contents are taken from our side.
1927 </p>
1928 <div class="paragraph"><p>This should not be confused with the <em>ours</em> merge strategy, which does not
1929 even look at what the other tree contains at all. It discards everything
1930 the other tree did, declaring <em>our</em> history contains all that happened in it.</p></div>
1931 </dd>
1932 <dt class="hdlist1">
1933 theirs
1934 </dt>
1935 <dd>
1937 This is the opposite of <em>ours</em>; note that, unlike <em>ours</em>, there is
1938 no <em>theirs</em> merge strategy to confuse this merge option with.
1939 </p>
1940 </dd>
1941 <dt class="hdlist1">
1942 ignore-space-change
1943 </dt>
1944 <dt class="hdlist1">
1945 ignore-all-space
1946 </dt>
1947 <dt class="hdlist1">
1948 ignore-space-at-eol
1949 </dt>
1950 <dt class="hdlist1">
1951 ignore-cr-at-eol
1952 </dt>
1953 <dd>
1955 Treats lines with the indicated type of whitespace change as
1956 unchanged for the sake of a three-way merge. Whitespace
1957 changes mixed with other changes to a line are not ignored.
1958 See also <a href="git-diff.html">git-diff(1)</a> <code>-b</code>, <code>-w</code>,
1959 <code>--ignore-space-at-eol</code>, and <code>--ignore-cr-at-eol</code>.
1960 </p>
1961 <div class="ulist"><ul>
1962 <li>
1964 If <em>their</em> version only introduces whitespace changes to a line,
1965 <em>our</em> version is used;
1966 </p>
1967 </li>
1968 <li>
1970 If <em>our</em> version introduces whitespace changes but <em>their</em>
1971 version includes a substantial change, <em>their</em> version is used;
1972 </p>
1973 </li>
1974 <li>
1976 Otherwise, the merge proceeds in the usual way.
1977 </p>
1978 </li>
1979 </ul></div>
1980 </dd>
1981 <dt class="hdlist1">
1982 renormalize
1983 </dt>
1984 <dd>
1986 This runs a virtual check-out and check-in of all three stages
1987 of a file when resolving a three-way merge. This option is
1988 meant to be used when merging branches with different clean
1989 filters or end-of-line normalization rules. See "Merging
1990 branches with differing checkin/checkout attributes" in
1991 <a href="gitattributes.html">gitattributes(5)</a> for details.
1992 </p>
1993 </dd>
1994 <dt class="hdlist1">
1995 no-renormalize
1996 </dt>
1997 <dd>
1999 Disables the <code>renormalize</code> option. This overrides the
2000 <code>merge.renormalize</code> configuration variable.
2001 </p>
2002 </dd>
2003 <dt class="hdlist1">
2004 find-renames[=&lt;n&gt;]
2005 </dt>
2006 <dd>
2008 Turn on rename detection, optionally setting the similarity
2009 threshold. This is the default. This overrides the
2010 <em>merge.renames</em> configuration variable.
2011 See also <a href="git-diff.html">git-diff(1)</a> <code>--find-renames</code>.
2012 </p>
2013 </dd>
2014 <dt class="hdlist1">
2015 rename-threshold=&lt;n&gt;
2016 </dt>
2017 <dd>
2019 Deprecated synonym for <code>find-renames=&lt;n&gt;</code>.
2020 </p>
2021 </dd>
2022 <dt class="hdlist1">
2023 subtree[=&lt;path&gt;]
2024 </dt>
2025 <dd>
2027 This option is a more advanced form of <em>subtree</em> strategy, where
2028 the strategy makes a guess on how two trees must be shifted to
2029 match with each other when merging. Instead, the specified path
2030 is prefixed (or stripped from the beginning) to make the shape of
2031 two trees to match.
2032 </p>
2033 </dd>
2034 </dl></div>
2035 </dd>
2036 <dt class="hdlist1">
2037 recursive
2038 </dt>
2039 <dd>
2041 This can only resolve two heads using a 3-way merge
2042 algorithm. When there is more than one common
2043 ancestor that can be used for 3-way merge, it creates a
2044 merged tree of the common ancestors and uses that as
2045 the reference tree for the 3-way merge. This has been
2046 reported to result in fewer merge conflicts without
2047 causing mismerges by tests done on actual merge commits
2048 taken from Linux 2.6 kernel development history.
2049 Additionally this can detect and handle merges involving
2050 renames. It does not make use of detected copies. This was
2051 the default strategy for resolving two heads from Git v0.99.9k
2052 until v2.33.0.
2053 </p>
2054 <div class="paragraph"><p>The <em>recursive</em> strategy takes the same options as <em>ort</em>. However,
2055 there are three additional options that <em>ort</em> ignores (not documented
2056 above) that are potentially useful with the <em>recursive</em> strategy:</p></div>
2057 <div class="dlist"><dl>
2058 <dt class="hdlist1">
2059 patience
2060 </dt>
2061 <dd>
2063 Deprecated synonym for <code>diff-algorithm=patience</code>.
2064 </p>
2065 </dd>
2066 <dt class="hdlist1">
2067 diff-algorithm=[patience|minimal|histogram|myers]
2068 </dt>
2069 <dd>
2071 Use a different diff algorithm while merging, which can help
2072 avoid mismerges that occur due to unimportant matching lines
2073 (such as braces from distinct functions). See also
2074 <a href="git-diff.html">git-diff(1)</a> <code>--diff-algorithm</code>. Note that <code>ort</code>
2075 specifically uses <code>diff-algorithm=histogram</code>, while <code>recursive</code>
2076 defaults to the <code>diff.algorithm</code> config setting.
2077 </p>
2078 </dd>
2079 <dt class="hdlist1">
2080 no-renames
2081 </dt>
2082 <dd>
2084 Turn off rename detection. This overrides the <code>merge.renames</code>
2085 configuration variable.
2086 See also <a href="git-diff.html">git-diff(1)</a> <code>--no-renames</code>.
2087 </p>
2088 </dd>
2089 </dl></div>
2090 </dd>
2091 <dt class="hdlist1">
2092 resolve
2093 </dt>
2094 <dd>
2096 This can only resolve two heads (i.e. the current branch
2097 and another branch you pulled from) using a 3-way merge
2098 algorithm. It tries to carefully detect criss-cross
2099 merge ambiguities. It does not handle renames.
2100 </p>
2101 </dd>
2102 <dt class="hdlist1">
2103 octopus
2104 </dt>
2105 <dd>
2107 This resolves cases with more than two heads, but refuses to do
2108 a complex merge that needs manual resolution. It is
2109 primarily meant to be used for bundling topic branch
2110 heads together. This is the default merge strategy when
2111 pulling or merging more than one branch.
2112 </p>
2113 </dd>
2114 <dt class="hdlist1">
2115 ours
2116 </dt>
2117 <dd>
2119 This resolves any number of heads, but the resulting tree of the
2120 merge is always that of the current branch head, effectively
2121 ignoring all changes from all other branches. It is meant to
2122 be used to supersede old development history of side
2123 branches. Note that this is different from the -Xours option to
2124 the <em>recursive</em> merge strategy.
2125 </p>
2126 </dd>
2127 <dt class="hdlist1">
2128 subtree
2129 </dt>
2130 <dd>
2132 This is a modified <code>ort</code> strategy. When merging trees A and
2133 B, if B corresponds to a subtree of A, B is first adjusted to
2134 match the tree structure of A, instead of reading the trees at
2135 the same level. This adjustment is also done to the common
2136 ancestor tree.
2137 </p>
2138 </dd>
2139 </dl></div>
2140 <div class="paragraph"><p>With the strategies that use 3-way merge (including the default, <em>ort</em>),
2141 if a change is made on both branches, but later reverted on one of the
2142 branches, that change will be present in the merged result; some people find
2143 this behavior confusing. It occurs because only the heads and the merge base
2144 are considered when performing a merge, not the individual commits. The merge
2145 algorithm therefore considers the reverted change as no change at all, and
2146 substitutes the changed version instead.</p></div>
2147 </div>
2148 </div>
2149 <div class="sect1">
2150 <h2 id="_default_behaviour">DEFAULT BEHAVIOUR</h2>
2151 <div class="sectionbody">
2152 <div class="paragraph"><p>Often people use <code>git pull</code> without giving any parameter.
2153 Traditionally, this has been equivalent to saying <code>git pull
2154 origin</code>. However, when configuration <code>branch.&lt;name&gt;.remote</code> is
2155 present while on branch <code>&lt;name&gt;</code>, that value is used instead of
2156 <code>origin</code>.</p></div>
2157 <div class="paragraph"><p>In order to determine what URL to use to fetch from, the value
2158 of the configuration <code>remote.&lt;origin&gt;.url</code> is consulted
2159 and if there is not any such variable, the value on the <code>URL:</code> line
2160 in <code>$GIT_DIR/remotes/&lt;origin&gt;</code> is used.</p></div>
2161 <div class="paragraph"><p>In order to determine what remote branches to fetch (and
2162 optionally store in the remote-tracking branches) when the command is
2163 run without any refspec parameters on the command line, values
2164 of the configuration variable <code>remote.&lt;origin&gt;.fetch</code> are
2165 consulted, and if there aren&#8217;t any, <code>$GIT_DIR/remotes/&lt;origin&gt;</code>
2166 is consulted and its <code>Pull:</code> lines are used.
2167 In addition to the refspec formats described in the OPTIONS
2168 section, you can have a globbing refspec that looks like this:</p></div>
2169 <div class="listingblock">
2170 <div class="content">
2171 <pre><code>refs/heads/*:refs/remotes/origin/*</code></pre>
2172 </div></div>
2173 <div class="paragraph"><p>A globbing refspec must have a non-empty RHS (i.e. must store
2174 what were fetched in remote-tracking branches), and its LHS and RHS
2175 must end with <code>/*</code>. The above specifies that all remote
2176 branches are tracked using remote-tracking branches in
2177 <code>refs/remotes/origin/</code> hierarchy under the same name.</p></div>
2178 <div class="paragraph"><p>The rule to determine which remote branch to merge after
2179 fetching is a bit involved, in order not to break backward
2180 compatibility.</p></div>
2181 <div class="paragraph"><p>If explicit refspecs were given on the command
2182 line of <code>git pull</code>, they are all merged.</p></div>
2183 <div class="paragraph"><p>When no refspec was given on the command line, then <code>git pull</code>
2184 uses the refspec from the configuration or
2185 <code>$GIT_DIR/remotes/&lt;origin&gt;</code>. In such cases, the following
2186 rules apply:</p></div>
2187 <div class="olist arabic"><ol class="arabic">
2188 <li>
2190 If <code>branch.&lt;name&gt;.merge</code> configuration for the current
2191 branch <code>&lt;name&gt;</code> exists, that is the name of the branch at the
2192 remote site that is merged.
2193 </p>
2194 </li>
2195 <li>
2197 If the refspec is a globbing one, nothing is merged.
2198 </p>
2199 </li>
2200 <li>
2202 Otherwise the remote branch of the first refspec is merged.
2203 </p>
2204 </li>
2205 </ol></div>
2206 </div>
2207 </div>
2208 <div class="sect1">
2209 <h2 id="_examples">EXAMPLES</h2>
2210 <div class="sectionbody">
2211 <div class="ulist"><ul>
2212 <li>
2214 Update the remote-tracking branches for the repository
2215 you cloned from, then merge one of them into your
2216 current branch:
2217 </p>
2218 <div class="listingblock">
2219 <div class="content">
2220 <pre><code>$ git pull
2221 $ git pull origin</code></pre>
2222 </div></div>
2223 <div class="paragraph"><p>Normally the branch merged in is the HEAD of the remote repository,
2224 but the choice is determined by the branch.&lt;name&gt;.remote and
2225 branch.&lt;name&gt;.merge options; see <a href="git-config.html">git-config(1)</a> for details.</p></div>
2226 </li>
2227 <li>
2229 Merge into the current branch the remote branch <code>next</code>:
2230 </p>
2231 <div class="listingblock">
2232 <div class="content">
2233 <pre><code>$ git pull origin next</code></pre>
2234 </div></div>
2235 <div class="paragraph"><p>This leaves a copy of <code>next</code> temporarily in FETCH_HEAD, and
2236 updates the remote-tracking branch <code>origin/next</code>.
2237 The same can be done by invoking fetch and merge:</p></div>
2238 <div class="listingblock">
2239 <div class="content">
2240 <pre><code>$ git fetch origin
2241 $ git merge origin/next</code></pre>
2242 </div></div>
2243 </li>
2244 </ul></div>
2245 <div class="paragraph"><p>If you tried a pull which resulted in complex conflicts and
2246 would want to start over, you can recover with <em>git reset</em>.</p></div>
2247 </div>
2248 </div>
2249 <div class="sect1">
2250 <h2 id="_security">SECURITY</h2>
2251 <div class="sectionbody">
2252 <div class="paragraph"><p>The fetch and push protocols are not designed to prevent one side from
2253 stealing data from the other repository that was not intended to be
2254 shared. If you have private data that you need to protect from a malicious
2255 peer, your best option is to store it in another repository. This applies
2256 to both clients and servers. In particular, namespaces on a server are not
2257 effective for read access control; you should only grant read access to a
2258 namespace to clients that you would trust with read access to the entire
2259 repository.</p></div>
2260 <div class="paragraph"><p>The known attack vectors are as follows:</p></div>
2261 <div class="olist arabic"><ol class="arabic">
2262 <li>
2264 The victim sends "have" lines advertising the IDs of objects it has that
2265 are not explicitly intended to be shared but can be used to optimize the
2266 transfer if the peer also has them. The attacker chooses an object ID X
2267 to steal and sends a ref to X, but isn&#8217;t required to send the content of
2268 X because the victim already has it. Now the victim believes that the
2269 attacker has X, and it sends the content of X back to the attacker
2270 later. (This attack is most straightforward for a client to perform on a
2271 server, by creating a ref to X in the namespace the client has access
2272 to and then fetching it. The most likely way for a server to perform it
2273 on a client is to "merge" X into a public branch and hope that the user
2274 does additional work on this branch and pushes it back to the server
2275 without noticing the merge.)
2276 </p>
2277 </li>
2278 <li>
2280 As in #1, the attacker chooses an object ID X to steal. The victim sends
2281 an object Y that the attacker already has, and the attacker falsely
2282 claims to have X and not Y, so the victim sends Y as a delta against X.
2283 The delta reveals regions of X that are similar to Y to the attacker.
2284 </p>
2285 </li>
2286 </ol></div>
2287 </div>
2288 </div>
2289 <div class="sect1">
2290 <h2 id="_bugs">BUGS</h2>
2291 <div class="sectionbody">
2292 <div class="paragraph"><p>Using --recurse-submodules can only fetch new commits in already checked
2293 out submodules right now. When e.g. upstream added a new submodule in the
2294 just fetched commits of the superproject the submodule itself cannot be
2295 fetched, making it impossible to check out that submodule later without
2296 having to do a fetch again. This is expected to be fixed in a future Git
2297 version.</p></div>
2298 </div>
2299 </div>
2300 <div class="sect1">
2301 <h2 id="_see_also">SEE ALSO</h2>
2302 <div class="sectionbody">
2303 <div class="paragraph"><p><a href="git-fetch.html">git-fetch(1)</a>, <a href="git-merge.html">git-merge(1)</a>, <a href="git-config.html">git-config(1)</a></p></div>
2304 </div>
2305 </div>
2306 <div class="sect1">
2307 <h2 id="_git">GIT</h2>
2308 <div class="sectionbody">
2309 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
2310 </div>
2311 </div>
2312 </div>
2313 <div id="footnotes"><hr /></div>
2314 <div id="footer">
2315 <div id="footer-text">
2316 Last updated
2317 2021-10-18 17:00:13 PDT
2318 </div>
2319 </div>
2320 </body>
2321 </html>