Autogenerated HTML docs for v2.45.1-204-gd8ab1
[git-htmldocs.git] / git-pull.html
blob346c0ec605926a36edcd816eb581c309f4ee02db
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="https://developercertificate.org">https://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 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 --[no-]all
1183 </dt>
1184 <dd>
1186 Fetch all remotes. This overrides the configuration variable
1187 <code>fetch.all</code>.
1188 </p>
1189 </dd>
1190 <dt class="hdlist1">
1192 </dt>
1193 <dt class="hdlist1">
1194 --append
1195 </dt>
1196 <dd>
1198 Append ref names and object names of fetched refs to the
1199 existing contents of <code>.git/FETCH_HEAD</code>. Without this
1200 option old data in <code>.git/FETCH_HEAD</code> will be overwritten.
1201 </p>
1202 </dd>
1203 <dt class="hdlist1">
1204 --atomic
1205 </dt>
1206 <dd>
1208 Use an atomic transaction to update local refs. Either all refs are
1209 updated, or on error, no refs are updated.
1210 </p>
1211 </dd>
1212 <dt class="hdlist1">
1213 --depth=&lt;depth&gt;
1214 </dt>
1215 <dd>
1217 Limit fetching to the specified number of commits from the tip of
1218 each remote branch history. If fetching to a <em>shallow</em> repository
1219 created by <code>git clone</code> with <code>--depth=&lt;depth&gt;</code> option (see
1220 <a href="git-clone.html">git-clone(1)</a>), deepen or shorten the history to the specified
1221 number of commits. Tags for the deepened commits are not fetched.
1222 </p>
1223 </dd>
1224 <dt class="hdlist1">
1225 --deepen=&lt;depth&gt;
1226 </dt>
1227 <dd>
1229 Similar to --depth, except it specifies the number of commits
1230 from the current shallow boundary instead of from the tip of
1231 each remote branch history.
1232 </p>
1233 </dd>
1234 <dt class="hdlist1">
1235 --shallow-since=&lt;date&gt;
1236 </dt>
1237 <dd>
1239 Deepen or shorten the history of a shallow repository to
1240 include all reachable commits after &lt;date&gt;.
1241 </p>
1242 </dd>
1243 <dt class="hdlist1">
1244 --shallow-exclude=&lt;revision&gt;
1245 </dt>
1246 <dd>
1248 Deepen or shorten the history of a shallow repository to
1249 exclude commits reachable from a specified remote branch or tag.
1250 This option can be specified multiple times.
1251 </p>
1252 </dd>
1253 <dt class="hdlist1">
1254 --unshallow
1255 </dt>
1256 <dd>
1258 If the source repository is complete, convert a shallow
1259 repository to a complete one, removing all the limitations
1260 imposed by shallow repositories.
1261 </p>
1262 <div class="paragraph"><p>If the source repository is shallow, fetch as much as possible so that
1263 the current repository has the same history as the source repository.</p></div>
1264 </dd>
1265 <dt class="hdlist1">
1266 --update-shallow
1267 </dt>
1268 <dd>
1270 By default when fetching from a shallow repository,
1271 <code>git fetch</code> refuses refs that require updating
1272 .git/shallow. This option updates .git/shallow and accepts such
1273 refs.
1274 </p>
1275 </dd>
1276 <dt class="hdlist1">
1277 --negotiation-tip=&lt;commit|glob&gt;
1278 </dt>
1279 <dd>
1281 By default, Git will report, to the server, commits reachable
1282 from all local refs to find common commits in an attempt to
1283 reduce the size of the to-be-received packfile. If specified,
1284 Git will only report commits reachable from the given tips.
1285 This is useful to speed up fetches when the user knows which
1286 local ref is likely to have commits in common with the
1287 upstream ref being fetched.
1288 </p>
1289 <div class="paragraph"><p>This option may be specified more than once; if so, Git will report
1290 commits reachable from any of the given commits.</p></div>
1291 <div class="paragraph"><p>The argument to this option may be a glob on ref names, a ref, or the (possibly
1292 abbreviated) SHA-1 of a commit. Specifying a glob is equivalent to specifying
1293 this option multiple times, one for each matching ref name.</p></div>
1294 <div class="paragraph"><p>See also the <code>fetch.negotiationAlgorithm</code> and <code>push.negotiate</code>
1295 configuration variables documented in <a href="git-config.html">git-config(1)</a>, and the
1296 <code>--negotiate-only</code> option below.</p></div>
1297 </dd>
1298 <dt class="hdlist1">
1299 --negotiate-only
1300 </dt>
1301 <dd>
1303 Do not fetch anything from the server, and instead print the
1304 ancestors of the provided <code>--negotiation-tip=*</code> arguments,
1305 which we have in common with the server.
1306 </p>
1307 <div class="paragraph"><p>This is incompatible with <code>--recurse-submodules=[yes|on-demand]</code>.
1308 Internally this is used to implement the <code>push.negotiate</code> option, see
1309 <a href="git-config.html">git-config(1)</a>.</p></div>
1310 </dd>
1311 <dt class="hdlist1">
1312 --dry-run
1313 </dt>
1314 <dd>
1316 Show what would be done, without making any changes.
1317 </p>
1318 </dd>
1319 <dt class="hdlist1">
1320 --porcelain
1321 </dt>
1322 <dd>
1324 Print the output to standard output in an easy-to-parse format for
1325 scripts. See section OUTPUT in <a href="git-fetch.html">git-fetch(1)</a> for details.
1326 </p>
1327 <div class="paragraph"><p>This is incompatible with <code>--recurse-submodules=[yes|on-demand]</code> and takes
1328 precedence over the <code>fetch.output</code> config option.</p></div>
1329 </dd>
1330 <dt class="hdlist1">
1332 </dt>
1333 <dt class="hdlist1">
1334 --force
1335 </dt>
1336 <dd>
1338 When <em>git fetch</em> is used with <code>&lt;src&gt;:&lt;dst&gt;</code> refspec, it may
1339 refuse to update the local branch as discussed
1340 in the <code>&lt;refspec&gt;</code> part of the <a href="git-fetch.html">git-fetch(1)</a>
1341 documentation.
1342 This option overrides that check.
1343 </p>
1344 </dd>
1345 <dt class="hdlist1">
1347 </dt>
1348 <dt class="hdlist1">
1349 --keep
1350 </dt>
1351 <dd>
1353 Keep downloaded pack.
1354 </p>
1355 </dd>
1356 <dt class="hdlist1">
1357 --prefetch
1358 </dt>
1359 <dd>
1361 Modify the configured refspec to place all refs into the
1362 <code>refs/prefetch/</code> namespace. See the <code>prefetch</code> task in
1363 <a href="git-maintenance.html">git-maintenance(1)</a>.
1364 </p>
1365 </dd>
1366 <dt class="hdlist1">
1368 </dt>
1369 <dt class="hdlist1">
1370 --prune
1371 </dt>
1372 <dd>
1374 Before fetching, remove any remote-tracking references that no
1375 longer exist on the remote. Tags are not subject to pruning
1376 if they are fetched only because of the default tag
1377 auto-following or due to a --tags option. However, if tags
1378 are fetched due to an explicit refspec (either on the command
1379 line or in the remote configuration, for example if the remote
1380 was cloned with the --mirror option), then they are also
1381 subject to pruning. Supplying <code>--prune-tags</code> is a shorthand for
1382 providing the tag refspec.
1383 </p>
1384 </dd>
1385 <dt class="hdlist1">
1386 --no-tags
1387 </dt>
1388 <dd>
1390 By default, tags that point at objects that are downloaded
1391 from the remote repository are fetched and stored locally.
1392 This option disables this automatic tag following. The default
1393 behavior for a remote may be specified with the remote.&lt;name&gt;.tagOpt
1394 setting. See <a href="git-config.html">git-config(1)</a>.
1395 </p>
1396 </dd>
1397 <dt class="hdlist1">
1398 --refmap=&lt;refspec&gt;
1399 </dt>
1400 <dd>
1402 When fetching refs listed on the command line, use the
1403 specified refspec (can be given more than once) to map the
1404 refs to remote-tracking branches, instead of the values of
1405 <code>remote.*.fetch</code> configuration variables for the remote
1406 repository. Providing an empty <code>&lt;refspec&gt;</code> to the
1407 <code>--refmap</code> option causes Git to ignore the configured
1408 refspecs and rely entirely on the refspecs supplied as
1409 command-line arguments. See section on "Configured Remote-tracking
1410 Branches" for details.
1411 </p>
1412 </dd>
1413 <dt class="hdlist1">
1415 </dt>
1416 <dt class="hdlist1">
1417 --tags
1418 </dt>
1419 <dd>
1421 Fetch all tags from the remote (i.e., fetch remote tags
1422 <code>refs/tags/*</code> into local tags with the same name), in addition
1423 to whatever else would otherwise be fetched. Using this
1424 option alone does not subject tags to pruning, even if --prune
1425 is used (though tags may be pruned anyway if they are also the
1426 destination of an explicit refspec; see <code>--prune</code>).
1427 </p>
1428 </dd>
1429 <dt class="hdlist1">
1431 </dt>
1432 <dt class="hdlist1">
1433 --jobs=&lt;n&gt;
1434 </dt>
1435 <dd>
1437 Number of parallel children to be used for all forms of fetching.
1438 </p>
1439 <div class="paragraph"><p>If the <code>--multiple</code> option was specified, the different remotes will be fetched
1440 in parallel. If multiple submodules are fetched, they will be fetched in
1441 parallel. To control them independently, use the config settings
1442 <code>fetch.parallel</code> and <code>submodule.fetchJobs</code> (see <a href="git-config.html">git-config(1)</a>).</p></div>
1443 <div class="paragraph"><p>Typically, parallel recursive and multi-remote fetches will be faster. By
1444 default fetches are performed sequentially, not in parallel.</p></div>
1445 </dd>
1446 <dt class="hdlist1">
1447 --set-upstream
1448 </dt>
1449 <dd>
1451 If the remote is fetched successfully, add upstream
1452 (tracking) reference, used by argument-less
1453 <a href="git-pull.html">git-pull(1)</a> and other commands. For more information,
1454 see <code>branch.&lt;name&gt;.merge</code> and <code>branch.&lt;name&gt;.remote</code> in
1455 <a href="git-config.html">git-config(1)</a>.
1456 </p>
1457 </dd>
1458 <dt class="hdlist1">
1459 --upload-pack &lt;upload-pack&gt;
1460 </dt>
1461 <dd>
1463 When given, and the repository to fetch from is handled
1464 by <em>git fetch-pack</em>, <code>--exec=&lt;upload-pack&gt;</code> is passed to
1465 the command to specify non-default path for the command
1466 run on the other end.
1467 </p>
1468 </dd>
1469 <dt class="hdlist1">
1470 --progress
1471 </dt>
1472 <dd>
1474 Progress status is reported on the standard error stream
1475 by default when it is attached to a terminal, unless -q
1476 is specified. This flag forces progress status even if the
1477 standard error stream is not directed to a terminal.
1478 </p>
1479 </dd>
1480 <dt class="hdlist1">
1481 -o &lt;option&gt;
1482 </dt>
1483 <dt class="hdlist1">
1484 --server-option=&lt;option&gt;
1485 </dt>
1486 <dd>
1488 Transmit the given string to the server when communicating using
1489 protocol version 2. The given string must not contain a NUL or LF
1490 character. The server&#8217;s handling of server options, including
1491 unknown ones, is server-specific.
1492 When multiple <code>--server-option=&lt;option&gt;</code> are given, they are all
1493 sent to the other side in the order listed on the command line.
1494 </p>
1495 </dd>
1496 <dt class="hdlist1">
1497 --show-forced-updates
1498 </dt>
1499 <dd>
1501 By default, git checks if a branch is force-updated during
1502 fetch. This can be disabled through fetch.showForcedUpdates, but
1503 the --show-forced-updates option guarantees this check occurs.
1504 See <a href="git-config.html">git-config(1)</a>.
1505 </p>
1506 </dd>
1507 <dt class="hdlist1">
1508 --no-show-forced-updates
1509 </dt>
1510 <dd>
1512 By default, git checks if a branch is force-updated during
1513 fetch. Pass --no-show-forced-updates or set fetch.showForcedUpdates
1514 to false to skip this check for performance reasons. If used during
1515 <em>git-pull</em> the --ff-only option will still check for forced updates
1516 before attempting a fast-forward update. See <a href="git-config.html">git-config(1)</a>.
1517 </p>
1518 </dd>
1519 <dt class="hdlist1">
1521 </dt>
1522 <dt class="hdlist1">
1523 --ipv4
1524 </dt>
1525 <dd>
1527 Use IPv4 addresses only, ignoring IPv6 addresses.
1528 </p>
1529 </dd>
1530 <dt class="hdlist1">
1532 </dt>
1533 <dt class="hdlist1">
1534 --ipv6
1535 </dt>
1536 <dd>
1538 Use IPv6 addresses only, ignoring IPv4 addresses.
1539 </p>
1540 </dd>
1541 <dt class="hdlist1">
1542 &lt;repository&gt;
1543 </dt>
1544 <dd>
1546 The "remote" repository that is the source of a fetch
1547 or pull operation. This parameter can be either a URL
1548 (see the section <a href="#URLS">GIT URLS</a> below) or the name
1549 of a remote (see the section <a href="#REMOTES">REMOTES</a> below).
1550 </p>
1551 </dd>
1552 <dt class="hdlist1">
1553 &lt;refspec&gt;
1554 </dt>
1555 <dd>
1557 Specifies which refs to fetch and which local refs to update.
1558 When no &lt;refspec&gt;s appear on the command line, the refs to fetch
1559 are read from <code>remote.&lt;repository&gt;.fetch</code> variables instead
1560 (see the section "CONFIGURED REMOTE-TRACKING BRANCHES"
1561 in <a href="git-fetch.html">git-fetch(1)</a>).
1562 </p>
1563 <div class="paragraph"><p>The format of a &lt;refspec&gt; parameter is an optional plus
1564 <code>+</code>, followed by the source &lt;src&gt;, followed
1565 by a colon <code>:</code>, followed by the destination ref &lt;dst&gt;.
1566 The colon can be omitted when &lt;dst&gt; is empty. &lt;src&gt; is
1567 typically a ref, but it can also be a fully spelled hex object
1568 name.</p></div>
1569 <div class="paragraph"><p>A &lt;refspec&gt; may contain a <code>*</code> in its &lt;src&gt; to indicate a simple pattern
1570 match. Such a refspec functions like a glob that matches any ref with the
1571 same prefix. A pattern &lt;refspec&gt; must have a <code>*</code> in both the &lt;src&gt; and
1572 &lt;dst&gt;. It will map refs to the destination by replacing the <code>*</code> with the
1573 contents matched from the source.</p></div>
1574 <div class="paragraph"><p>If a refspec is prefixed by <code>^</code>, it will be interpreted as a negative
1575 refspec. Rather than specifying which refs to fetch or which local refs to
1576 update, such a refspec will instead specify refs to exclude. A ref will be
1577 considered to match if it matches at least one positive refspec, and does
1578 not match any negative refspec. Negative refspecs can be useful to restrict
1579 the scope of a pattern refspec so that it will not include specific refs.
1580 Negative refspecs can themselves be pattern refspecs. However, they may only
1581 contain a &lt;src&gt; and do not specify a &lt;dst&gt;. Fully spelled out hex object
1582 names are also not supported.</p></div>
1583 <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>;
1584 it requests fetching everything up to the given tag.</p></div>
1585 <div class="paragraph"><p>The remote ref that matches &lt;src&gt;
1586 is fetched, and if &lt;dst&gt; is not an empty string, an attempt
1587 is made to update the local ref that matches it.</p></div>
1588 <div class="paragraph"><p>Whether that update is allowed without <code>--force</code> depends on the ref
1589 namespace it&#8217;s being fetched to, the type of object being fetched, and
1590 whether the update is considered to be a fast-forward. Generally, the
1591 same rules apply for fetching as when pushing, see the <code>&lt;refspec&gt;...</code>
1592 section of <a href="git-push.html">git-push(1)</a> for what those are. Exceptions to those
1593 rules particular to <em>git fetch</em> are noted below.</p></div>
1594 <div class="paragraph"><p>Until Git version 2.20, and unlike when pushing with
1595 <a href="git-push.html">git-push(1)</a>, any updates to <code>refs/tags/*</code> would be accepted
1596 without <code>+</code> in the refspec (or <code>--force</code>). When fetching, we promiscuously
1597 considered all tag updates from a remote to be forced fetches. Since
1598 Git version 2.20, fetching to update <code>refs/tags/*</code> works the same way
1599 as when pushing. I.e. any updates will be rejected without <code>+</code> in the
1600 refspec (or <code>--force</code>).</p></div>
1601 <div class="paragraph"><p>Unlike when pushing with <a href="git-push.html">git-push(1)</a>, any updates outside of
1602 <code>refs/{tags,heads}/*</code> will be accepted without <code>+</code> in the refspec (or
1603 <code>--force</code>), whether that&#8217;s swapping e.g. a tree object for a blob, or
1604 a commit for another commit that doesn&#8217;t have the previous commit as
1605 an ancestor etc.</p></div>
1606 <div class="paragraph"><p>Unlike when pushing with <a href="git-push.html">git-push(1)</a>, there is no
1607 configuration which&#8217;ll amend these rules, and nothing like a
1608 <code>pre-fetch</code> hook analogous to the <code>pre-receive</code> hook.</p></div>
1609 <div class="paragraph"><p>As with pushing with <a href="git-push.html">git-push(1)</a>, all of the rules described
1610 above about what&#8217;s not allowed as an update can be overridden by
1611 adding an optional leading <code>+</code> to a refspec (or using the <code>--force</code>
1612 command line option). The only exception to this is that no amount of
1613 forcing will make the <code>refs/heads/*</code> namespace accept a non-commit
1614 object.</p></div>
1615 <div class="admonitionblock">
1616 <table><tr>
1617 <td class="icon">
1618 <div class="title">Note</div>
1619 </td>
1620 <td class="content">When the remote branch you want to fetch is known to
1621 be rewound and rebased regularly, it is expected that
1622 its new tip will not be a descendant of its previous tip
1623 (as stored in your remote-tracking branch the last time
1624 you fetched). You would want
1625 to use the <code>+</code> sign to indicate non-fast-forward updates
1626 will be needed for such branches. There is no way to
1627 determine or declare that a branch will be made available
1628 in a repository with this behavior; the pulling user simply
1629 must know this is the expected usage pattern for a branch.</td>
1630 </tr></table>
1631 </div>
1632 <div class="admonitionblock">
1633 <table><tr>
1634 <td class="icon">
1635 <div class="title">Note</div>
1636 </td>
1637 <td class="content">There is a difference between listing multiple &lt;refspec&gt;
1638 directly on <em>git pull</em> command line and having multiple
1639 <code>remote.&lt;repository&gt;.fetch</code> entries in your configuration
1640 for a &lt;repository&gt; and running a
1641 <em>git pull</em> command without any explicit &lt;refspec&gt; parameters.
1642 &lt;refspec&gt;s listed explicitly on the command line are always
1643 merged into the current branch after fetching. In other words,
1644 if you list more than one remote ref, <em>git pull</em> will create
1645 an Octopus merge. On the other hand, if you do not list any
1646 explicit &lt;refspec&gt; parameter on the command line, <em>git pull</em>
1647 will fetch all the &lt;refspec&gt;s it finds in the
1648 <code>remote.&lt;repository&gt;.fetch</code> configuration and merge
1649 only the first &lt;refspec&gt; found into the current branch.
1650 This is because making an
1651 Octopus from remote refs is rarely done, while keeping track
1652 of multiple remote heads in one-go by fetching more than one
1653 is often useful.</td>
1654 </tr></table>
1655 </div>
1656 </dd>
1657 </dl></div>
1658 </div>
1659 </div>
1660 </div>
1661 <div class="sect1">
1662 <h2 id="_git_urls_a_id_urls_a">GIT URLS<a id="URLS"></a></h2>
1663 <div class="sectionbody">
1664 <div class="paragraph"><p>In general, URLs contain information about the transport protocol, the
1665 address of the remote server, and the path to the repository.
1666 Depending on the transport protocol, some of this information may be
1667 absent.</p></div>
1668 <div class="paragraph"><p>Git supports ssh, git, http, and https protocols (in addition, ftp
1669 and ftps can be used for fetching, but this is inefficient and
1670 deprecated; do not use them).</p></div>
1671 <div class="paragraph"><p>The native transport (i.e. git:// URL) does no authentication and
1672 should be used with caution on unsecured networks.</p></div>
1673 <div class="paragraph"><p>The following syntaxes may be used with them:</p></div>
1674 <div class="ulist"><ul>
1675 <li>
1677 <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>
1678 </p>
1679 </li>
1680 <li>
1682 <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>
1683 </p>
1684 </li>
1685 <li>
1687 <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>
1688 </p>
1689 </li>
1690 <li>
1692 <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>
1693 </p>
1694 </li>
1695 </ul></div>
1696 <div class="paragraph"><p>An alternative scp-like syntax may also be used with the ssh protocol:</p></div>
1697 <div class="ulist"><ul>
1698 <li>
1700 &#91;<em>&lt;user&gt;</em><code>@</code>&#93;<em>&lt;host&gt;</em><code>:/</code><em>&lt;path-to-git-repo&gt;</em>
1701 </p>
1702 </li>
1703 </ul></div>
1704 <div class="paragraph"><p>This syntax is only recognized if there are no slashes before the
1705 first colon. This helps differentiate a local path that contains a
1706 colon. For example the local path <code>foo:bar</code> could be specified as an
1707 absolute path or <code>./foo:bar</code> to avoid being misinterpreted as an ssh
1708 url.</p></div>
1709 <div class="paragraph"><p>The ssh and git protocols additionally support <code>~</code><em>&lt;username&gt;</em> expansion:</p></div>
1710 <div class="ulist"><ul>
1711 <li>
1713 <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>
1714 </p>
1715 </li>
1716 <li>
1718 <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>
1719 </p>
1720 </li>
1721 <li>
1723 &#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>
1724 </p>
1725 </li>
1726 </ul></div>
1727 <div class="paragraph"><p>For local repositories, also supported by Git natively, the following
1728 syntaxes may be used:</p></div>
1729 <div class="ulist"><ul>
1730 <li>
1732 <code>/path/to/repo.git/</code>
1733 </p>
1734 </li>
1735 <li>
1737 <code>file:///path/to/repo.git/</code>
1738 </p>
1739 </li>
1740 </ul></div>
1741 <div class="paragraph"><p>These two syntaxes are mostly equivalent, except when cloning, when
1742 the former implies <code>--local</code> option. See <a href="git-clone.html">git-clone(1)</a> for
1743 details.</p></div>
1744 <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
1745 accept a suitable bundle file. See <a href="git-bundle.html">git-bundle(1)</a>.</p></div>
1746 <div class="paragraph"><p>When Git doesn&#8217;t know how to handle a certain transport protocol, it
1747 attempts to use the <code>remote-</code><em>&lt;transport&gt;</em> remote helper, if one
1748 exists. To explicitly request a remote helper, the following syntax
1749 may be used:</p></div>
1750 <div class="ulist"><ul>
1751 <li>
1753 <em>&lt;transport&gt;</em>::<em>&lt;address&gt;</em>
1754 </p>
1755 </li>
1756 </ul></div>
1757 <div class="paragraph"><p>where <em>&lt;address&gt;</em> may be a path, a server and path, or an arbitrary
1758 URL-like string recognized by the specific remote helper being
1759 invoked. See <a href="gitremote-helpers.html">gitremote-helpers(7)</a> for details.</p></div>
1760 <div class="paragraph"><p>If there are a large number of similarly-named remote repositories and
1761 you want to use a different format for them (such that the URLs you
1762 use will be rewritten into URLs that work), you can create a
1763 configuration section of the form:</p></div>
1764 <div class="verseblock">
1765 <pre class="content"> [url "<em>&lt;actual-url-base&gt;</em>"]
1766 insteadOf = <em>&lt;other-url-base&gt;</em></pre>
1767 <div class="attribution">
1768 </div></div>
1769 <div class="paragraph"><p>For example, with this:</p></div>
1770 <div class="listingblock">
1771 <div class="content">
1772 <pre><code> [url "git://git.host.xz/"]
1773 insteadOf = host.xz:/path/to/
1774 insteadOf = work:</code></pre>
1775 </div></div>
1776 <div class="paragraph"><p>a URL like "work:repo.git" or like "host.xz:/path/to/repo.git" will be
1777 rewritten in any context that takes a URL to be "git://git.host.xz/repo.git".</p></div>
1778 <div class="paragraph"><p>If you want to rewrite URLs for push only, you can create a
1779 configuration section of the form:</p></div>
1780 <div class="verseblock">
1781 <pre class="content"> [url "<em>&lt;actual-url-base&gt;</em>"]
1782 pushInsteadOf = <em>&lt;other-url-base&gt;</em></pre>
1783 <div class="attribution">
1784 </div></div>
1785 <div class="paragraph"><p>For example, with this:</p></div>
1786 <div class="listingblock">
1787 <div class="content">
1788 <pre><code> [url "ssh://example.org/"]
1789 pushInsteadOf = git://example.org/</code></pre>
1790 </div></div>
1791 <div class="paragraph"><p>a URL like "git://example.org/path/to/repo.git" will be rewritten to
1792 "ssh://example.org/path/to/repo.git" for pushes, but pulls will still
1793 use the original URL.</p></div>
1794 </div>
1795 </div>
1796 <div class="sect1">
1797 <h2 id="_remotes_a_id_remotes_a">REMOTES<a id="REMOTES"></a></h2>
1798 <div class="sectionbody">
1799 <div class="paragraph"><p>The name of one of the following can be used instead
1800 of a URL as <code>&lt;repository&gt;</code> argument:</p></div>
1801 <div class="ulist"><ul>
1802 <li>
1804 a remote in the Git configuration file: <code>$GIT_DIR/config</code>,
1805 </p>
1806 </li>
1807 <li>
1809 a file in the <code>$GIT_DIR/remotes</code> directory, or
1810 </p>
1811 </li>
1812 <li>
1814 a file in the <code>$GIT_DIR/branches</code> directory.
1815 </p>
1816 </li>
1817 </ul></div>
1818 <div class="paragraph"><p>All of these also allow you to omit the refspec from the command line
1819 because they each contain a refspec which git will use by default.</p></div>
1820 <div class="sect2">
1821 <h3 id="_named_remote_in_configuration_file">Named remote in configuration file</h3>
1822 <div class="paragraph"><p>You can choose to provide the name of a remote which you had previously
1823 configured using <a href="git-remote.html">git-remote(1)</a>, <a href="git-config.html">git-config(1)</a>
1824 or even by a manual edit to the <code>$GIT_DIR/config</code> file. The URL of
1825 this remote will be used to access the repository. The refspec
1826 of this remote will be used by default when you do
1827 not provide a refspec on the command line. The entry in the
1828 config file would appear like this:</p></div>
1829 <div class="listingblock">
1830 <div class="content">
1831 <pre><code> [remote "&lt;name&gt;"]
1832 url = &lt;URL&gt;
1833 pushurl = &lt;pushurl&gt;
1834 push = &lt;refspec&gt;
1835 fetch = &lt;refspec&gt;</code></pre>
1836 </div></div>
1837 <div class="paragraph"><p>The <code>&lt;pushurl&gt;</code> is used for pushes only. It is optional and defaults
1838 to <code>&lt;URL&gt;</code>. Pushing to a remote affects all defined pushurls or all
1839 defined urls if no pushurls are defined. Fetch, however, will only
1840 fetch from the first defined url if multiple urls are defined.</p></div>
1841 </div>
1842 <div class="sect2">
1843 <h3 id="_named_file_in_code_git_dir_remotes_code">Named file in <code>$GIT_DIR/remotes</code></h3>
1844 <div class="paragraph"><p>You can choose to provide the name of a
1845 file in <code>$GIT_DIR/remotes</code>. The URL
1846 in this file will be used to access the repository. The refspec
1847 in this file will be used as default when you do not
1848 provide a refspec on the command line. This file should have the
1849 following format:</p></div>
1850 <div class="listingblock">
1851 <div class="content">
1852 <pre><code> URL: one of the above URL formats
1853 Push: &lt;refspec&gt;
1854 Pull: &lt;refspec&gt;</code></pre>
1855 </div></div>
1856 <div class="paragraph"><p><code>Push:</code> lines are used by <em>git push</em> and
1857 <code>Pull:</code> lines are used by <em>git pull</em> and <em>git fetch</em>.
1858 Multiple <code>Push:</code> and <code>Pull:</code> lines may
1859 be specified for additional branch mappings.</p></div>
1860 </div>
1861 <div class="sect2">
1862 <h3 id="_named_file_in_code_git_dir_branches_code">Named file in <code>$GIT_DIR/branches</code></h3>
1863 <div class="paragraph"><p>You can choose to provide the name of a
1864 file in <code>$GIT_DIR/branches</code>.
1865 The URL in this file will be used to access the repository.
1866 This file should have the following format:</p></div>
1867 <div class="listingblock">
1868 <div class="content">
1869 <pre><code> &lt;URL&gt;#&lt;head&gt;</code></pre>
1870 </div></div>
1871 <div class="paragraph"><p><code>&lt;URL&gt;</code> is required; <code>#&lt;head&gt;</code> is optional.</p></div>
1872 <div class="paragraph"><p>Depending on the operation, git will use one of the following
1873 refspecs, if you don&#8217;t provide one on the command line.
1874 <code>&lt;branch&gt;</code> is the name of this file in <code>$GIT_DIR/branches</code> and
1875 <code>&lt;head&gt;</code> defaults to <code>master</code>.</p></div>
1876 <div class="paragraph"><p>git fetch uses:</p></div>
1877 <div class="listingblock">
1878 <div class="content">
1879 <pre><code> refs/heads/&lt;head&gt;:refs/heads/&lt;branch&gt;</code></pre>
1880 </div></div>
1881 <div class="paragraph"><p>git push uses:</p></div>
1882 <div class="listingblock">
1883 <div class="content">
1884 <pre><code> HEAD:refs/heads/&lt;head&gt;</code></pre>
1885 </div></div>
1886 </div>
1887 </div>
1888 </div>
1889 <div class="sect1">
1890 <h2 id="_merge_strategies">MERGE STRATEGIES</h2>
1891 <div class="sectionbody">
1892 <div class="paragraph"><p>The merge mechanism (<code>git merge</code> and <code>git pull</code> commands) allows the
1893 backend <em>merge strategies</em> to be chosen with <code>-s</code> option. Some strategies
1894 can also take their own options, which can be passed by giving <code>-X&lt;option&gt;</code>
1895 arguments to <code>git merge</code> and/or <code>git pull</code>.</p></div>
1896 <div class="dlist"><dl>
1897 <dt class="hdlist1">
1899 </dt>
1900 <dd>
1902 This is the default merge strategy when pulling or merging one
1903 branch. This strategy can only resolve two heads using a
1904 3-way merge algorithm. When there is more than one common
1905 ancestor that can be used for 3-way merge, it creates a merged
1906 tree of the common ancestors and uses that as the reference
1907 tree for the 3-way merge. This has been reported to result in
1908 fewer merge conflicts without causing mismerges by tests done
1909 on actual merge commits taken from Linux 2.6 kernel
1910 development history. Additionally this strategy can detect
1911 and handle merges involving renames. It does not make use of
1912 detected copies. The name for this algorithm is an acronym
1913 ("Ostensibly Recursive&#8217;s Twin") and came from the fact that it
1914 was written as a replacement for the previous default
1915 algorithm, <code>recursive</code>.
1916 </p>
1917 <div class="paragraph"><p>The <em>ort</em> strategy can take the following options:</p></div>
1918 <div class="dlist"><dl>
1919 <dt class="hdlist1">
1920 ours
1921 </dt>
1922 <dd>
1924 This option forces conflicting hunks to be auto-resolved cleanly by
1925 favoring <em>our</em> version. Changes from the other tree that do not
1926 conflict with our side are reflected in the merge result.
1927 For a binary file, the entire contents are taken from our side.
1928 </p>
1929 <div class="paragraph"><p>This should not be confused with the <em>ours</em> merge strategy, which does not
1930 even look at what the other tree contains at all. It discards everything
1931 the other tree did, declaring <em>our</em> history contains all that happened in it.</p></div>
1932 </dd>
1933 <dt class="hdlist1">
1934 theirs
1935 </dt>
1936 <dd>
1938 This is the opposite of <em>ours</em>; note that, unlike <em>ours</em>, there is
1939 no <em>theirs</em> merge strategy to confuse this merge option with.
1940 </p>
1941 </dd>
1942 <dt class="hdlist1">
1943 ignore-space-change
1944 </dt>
1945 <dt class="hdlist1">
1946 ignore-all-space
1947 </dt>
1948 <dt class="hdlist1">
1949 ignore-space-at-eol
1950 </dt>
1951 <dt class="hdlist1">
1952 ignore-cr-at-eol
1953 </dt>
1954 <dd>
1956 Treats lines with the indicated type of whitespace change as
1957 unchanged for the sake of a three-way merge. Whitespace
1958 changes mixed with other changes to a line are not ignored.
1959 See also <a href="git-diff.html">git-diff(1)</a> <code>-b</code>, <code>-w</code>,
1960 <code>--ignore-space-at-eol</code>, and <code>--ignore-cr-at-eol</code>.
1961 </p>
1962 <div class="ulist"><ul>
1963 <li>
1965 If <em>their</em> version only introduces whitespace changes to a line,
1966 <em>our</em> version is used;
1967 </p>
1968 </li>
1969 <li>
1971 If <em>our</em> version introduces whitespace changes but <em>their</em>
1972 version includes a substantial change, <em>their</em> version is used;
1973 </p>
1974 </li>
1975 <li>
1977 Otherwise, the merge proceeds in the usual way.
1978 </p>
1979 </li>
1980 </ul></div>
1981 </dd>
1982 <dt class="hdlist1">
1983 renormalize
1984 </dt>
1985 <dd>
1987 This runs a virtual check-out and check-in of all three stages
1988 of a file when resolving a three-way merge. This option is
1989 meant to be used when merging branches with different clean
1990 filters or end-of-line normalization rules. See "Merging
1991 branches with differing checkin/checkout attributes" in
1992 <a href="gitattributes.html">gitattributes(5)</a> for details.
1993 </p>
1994 </dd>
1995 <dt class="hdlist1">
1996 no-renormalize
1997 </dt>
1998 <dd>
2000 Disables the <code>renormalize</code> option. This overrides the
2001 <code>merge.renormalize</code> configuration variable.
2002 </p>
2003 </dd>
2004 <dt class="hdlist1">
2005 find-renames[=&lt;n&gt;]
2006 </dt>
2007 <dd>
2009 Turn on rename detection, optionally setting the similarity
2010 threshold. This is the default. This overrides the
2011 <em>merge.renames</em> configuration variable.
2012 See also <a href="git-diff.html">git-diff(1)</a> <code>--find-renames</code>.
2013 </p>
2014 </dd>
2015 <dt class="hdlist1">
2016 rename-threshold=&lt;n&gt;
2017 </dt>
2018 <dd>
2020 Deprecated synonym for <code>find-renames=&lt;n&gt;</code>.
2021 </p>
2022 </dd>
2023 <dt class="hdlist1">
2024 subtree[=&lt;path&gt;]
2025 </dt>
2026 <dd>
2028 This option is a more advanced form of <em>subtree</em> strategy, where
2029 the strategy makes a guess on how two trees must be shifted to
2030 match with each other when merging. Instead, the specified path
2031 is prefixed (or stripped from the beginning) to make the shape of
2032 two trees to match.
2033 </p>
2034 </dd>
2035 </dl></div>
2036 </dd>
2037 <dt class="hdlist1">
2038 recursive
2039 </dt>
2040 <dd>
2042 This can only resolve two heads using a 3-way merge
2043 algorithm. When there is more than one common
2044 ancestor that can be used for 3-way merge, it creates a
2045 merged tree of the common ancestors and uses that as
2046 the reference tree for the 3-way merge. This has been
2047 reported to result in fewer merge conflicts without
2048 causing mismerges by tests done on actual merge commits
2049 taken from Linux 2.6 kernel development history.
2050 Additionally this can detect and handle merges involving
2051 renames. It does not make use of detected copies. This was
2052 the default strategy for resolving two heads from Git v0.99.9k
2053 until v2.33.0.
2054 </p>
2055 <div class="paragraph"><p>The <em>recursive</em> strategy takes the same options as <em>ort</em>. However,
2056 there are three additional options that <em>ort</em> ignores (not documented
2057 above) that are potentially useful with the <em>recursive</em> strategy:</p></div>
2058 <div class="dlist"><dl>
2059 <dt class="hdlist1">
2060 patience
2061 </dt>
2062 <dd>
2064 Deprecated synonym for <code>diff-algorithm=patience</code>.
2065 </p>
2066 </dd>
2067 <dt class="hdlist1">
2068 diff-algorithm=[patience|minimal|histogram|myers]
2069 </dt>
2070 <dd>
2072 Use a different diff algorithm while merging, which can help
2073 avoid mismerges that occur due to unimportant matching lines
2074 (such as braces from distinct functions). See also
2075 <a href="git-diff.html">git-diff(1)</a> <code>--diff-algorithm</code>. Note that <code>ort</code>
2076 specifically uses <code>diff-algorithm=histogram</code>, while <code>recursive</code>
2077 defaults to the <code>diff.algorithm</code> config setting.
2078 </p>
2079 </dd>
2080 <dt class="hdlist1">
2081 no-renames
2082 </dt>
2083 <dd>
2085 Turn off rename detection. This overrides the <code>merge.renames</code>
2086 configuration variable.
2087 See also <a href="git-diff.html">git-diff(1)</a> <code>--no-renames</code>.
2088 </p>
2089 </dd>
2090 </dl></div>
2091 </dd>
2092 <dt class="hdlist1">
2093 resolve
2094 </dt>
2095 <dd>
2097 This can only resolve two heads (i.e. the current branch
2098 and another branch you pulled from) using a 3-way merge
2099 algorithm. It tries to carefully detect criss-cross
2100 merge ambiguities. It does not handle renames.
2101 </p>
2102 </dd>
2103 <dt class="hdlist1">
2104 octopus
2105 </dt>
2106 <dd>
2108 This resolves cases with more than two heads, but refuses to do
2109 a complex merge that needs manual resolution. It is
2110 primarily meant to be used for bundling topic branch
2111 heads together. This is the default merge strategy when
2112 pulling or merging more than one branch.
2113 </p>
2114 </dd>
2115 <dt class="hdlist1">
2116 ours
2117 </dt>
2118 <dd>
2120 This resolves any number of heads, but the resulting tree of the
2121 merge is always that of the current branch head, effectively
2122 ignoring all changes from all other branches. It is meant to
2123 be used to supersede old development history of side
2124 branches. Note that this is different from the -Xours option to
2125 the <em>recursive</em> merge strategy.
2126 </p>
2127 </dd>
2128 <dt class="hdlist1">
2129 subtree
2130 </dt>
2131 <dd>
2133 This is a modified <code>ort</code> strategy. When merging trees A and
2134 B, if B corresponds to a subtree of A, B is first adjusted to
2135 match the tree structure of A, instead of reading the trees at
2136 the same level. This adjustment is also done to the common
2137 ancestor tree.
2138 </p>
2139 </dd>
2140 </dl></div>
2141 <div class="paragraph"><p>With the strategies that use 3-way merge (including the default, <em>ort</em>),
2142 if a change is made on both branches, but later reverted on one of the
2143 branches, that change will be present in the merged result; some people find
2144 this behavior confusing. It occurs because only the heads and the merge base
2145 are considered when performing a merge, not the individual commits. The merge
2146 algorithm therefore considers the reverted change as no change at all, and
2147 substitutes the changed version instead.</p></div>
2148 </div>
2149 </div>
2150 <div class="sect1">
2151 <h2 id="_default_behaviour">DEFAULT BEHAVIOUR</h2>
2152 <div class="sectionbody">
2153 <div class="paragraph"><p>Often people use <code>git pull</code> without giving any parameter.
2154 Traditionally, this has been equivalent to saying <code>git pull
2155 origin</code>. However, when configuration <code>branch.&lt;name&gt;.remote</code> is
2156 present while on branch <code>&lt;name&gt;</code>, that value is used instead of
2157 <code>origin</code>.</p></div>
2158 <div class="paragraph"><p>In order to determine what URL to use to fetch from, the value
2159 of the configuration <code>remote.&lt;origin&gt;.url</code> is consulted
2160 and if there is not any such variable, the value on the <code>URL:</code> line
2161 in <code>$GIT_DIR/remotes/&lt;origin&gt;</code> is used.</p></div>
2162 <div class="paragraph"><p>In order to determine what remote branches to fetch (and
2163 optionally store in the remote-tracking branches) when the command is
2164 run without any refspec parameters on the command line, values
2165 of the configuration variable <code>remote.&lt;origin&gt;.fetch</code> are
2166 consulted, and if there aren&#8217;t any, <code>$GIT_DIR/remotes/&lt;origin&gt;</code>
2167 is consulted and its <code>Pull:</code> lines are used.
2168 In addition to the refspec formats described in the OPTIONS
2169 section, you can have a globbing refspec that looks like this:</p></div>
2170 <div class="listingblock">
2171 <div class="content">
2172 <pre><code>refs/heads/*:refs/remotes/origin/*</code></pre>
2173 </div></div>
2174 <div class="paragraph"><p>A globbing refspec must have a non-empty RHS (i.e. must store
2175 what were fetched in remote-tracking branches), and its LHS and RHS
2176 must end with <code>/*</code>. The above specifies that all remote
2177 branches are tracked using remote-tracking branches in
2178 <code>refs/remotes/origin/</code> hierarchy under the same name.</p></div>
2179 <div class="paragraph"><p>The rule to determine which remote branch to merge after
2180 fetching is a bit involved, in order not to break backward
2181 compatibility.</p></div>
2182 <div class="paragraph"><p>If explicit refspecs were given on the command
2183 line of <code>git pull</code>, they are all merged.</p></div>
2184 <div class="paragraph"><p>When no refspec was given on the command line, then <code>git pull</code>
2185 uses the refspec from the configuration or
2186 <code>$GIT_DIR/remotes/&lt;origin&gt;</code>. In such cases, the following
2187 rules apply:</p></div>
2188 <div class="olist arabic"><ol class="arabic">
2189 <li>
2191 If <code>branch.&lt;name&gt;.merge</code> configuration for the current
2192 branch <code>&lt;name&gt;</code> exists, that is the name of the branch at the
2193 remote site that is merged.
2194 </p>
2195 </li>
2196 <li>
2198 If the refspec is a globbing one, nothing is merged.
2199 </p>
2200 </li>
2201 <li>
2203 Otherwise the remote branch of the first refspec is merged.
2204 </p>
2205 </li>
2206 </ol></div>
2207 </div>
2208 </div>
2209 <div class="sect1">
2210 <h2 id="_examples">EXAMPLES</h2>
2211 <div class="sectionbody">
2212 <div class="ulist"><ul>
2213 <li>
2215 Update the remote-tracking branches for the repository
2216 you cloned from, then merge one of them into your
2217 current branch:
2218 </p>
2219 <div class="listingblock">
2220 <div class="content">
2221 <pre><code>$ git pull
2222 $ git pull origin</code></pre>
2223 </div></div>
2224 <div class="paragraph"><p>Normally the branch merged in is the HEAD of the remote repository,
2225 but the choice is determined by the branch.&lt;name&gt;.remote and
2226 branch.&lt;name&gt;.merge options; see <a href="git-config.html">git-config(1)</a> for details.</p></div>
2227 </li>
2228 <li>
2230 Merge into the current branch the remote branch <code>next</code>:
2231 </p>
2232 <div class="listingblock">
2233 <div class="content">
2234 <pre><code>$ git pull origin next</code></pre>
2235 </div></div>
2236 <div class="paragraph"><p>This leaves a copy of <code>next</code> temporarily in FETCH_HEAD, and
2237 updates the remote-tracking branch <code>origin/next</code>.
2238 The same can be done by invoking fetch and merge:</p></div>
2239 <div class="listingblock">
2240 <div class="content">
2241 <pre><code>$ git fetch origin
2242 $ git merge origin/next</code></pre>
2243 </div></div>
2244 </li>
2245 </ul></div>
2246 <div class="paragraph"><p>If you tried a pull which resulted in complex conflicts and
2247 would want to start over, you can recover with <em>git reset</em>.</p></div>
2248 </div>
2249 </div>
2250 <div class="sect1">
2251 <h2 id="_security">SECURITY</h2>
2252 <div class="sectionbody">
2253 <div class="paragraph"><p>The fetch and push protocols are not designed to prevent one side from
2254 stealing data from the other repository that was not intended to be
2255 shared. If you have private data that you need to protect from a malicious
2256 peer, your best option is to store it in another repository. This applies
2257 to both clients and servers. In particular, namespaces on a server are not
2258 effective for read access control; you should only grant read access to a
2259 namespace to clients that you would trust with read access to the entire
2260 repository.</p></div>
2261 <div class="paragraph"><p>The known attack vectors are as follows:</p></div>
2262 <div class="olist arabic"><ol class="arabic">
2263 <li>
2265 The victim sends "have" lines advertising the IDs of objects it has that
2266 are not explicitly intended to be shared but can be used to optimize the
2267 transfer if the peer also has them. The attacker chooses an object ID X
2268 to steal and sends a ref to X, but isn&#8217;t required to send the content of
2269 X because the victim already has it. Now the victim believes that the
2270 attacker has X, and it sends the content of X back to the attacker
2271 later. (This attack is most straightforward for a client to perform on a
2272 server, by creating a ref to X in the namespace the client has access
2273 to and then fetching it. The most likely way for a server to perform it
2274 on a client is to "merge" X into a public branch and hope that the user
2275 does additional work on this branch and pushes it back to the server
2276 without noticing the merge.)
2277 </p>
2278 </li>
2279 <li>
2281 As in #1, the attacker chooses an object ID X to steal. The victim sends
2282 an object Y that the attacker already has, and the attacker falsely
2283 claims to have X and not Y, so the victim sends Y as a delta against X.
2284 The delta reveals regions of X that are similar to Y to the attacker.
2285 </p>
2286 </li>
2287 </ol></div>
2288 </div>
2289 </div>
2290 <div class="sect1">
2291 <h2 id="_bugs">BUGS</h2>
2292 <div class="sectionbody">
2293 <div class="paragraph"><p>Using --recurse-submodules can only fetch new commits in already checked
2294 out submodules right now. When e.g. upstream added a new submodule in the
2295 just fetched commits of the superproject the submodule itself cannot be
2296 fetched, making it impossible to check out that submodule later without
2297 having to do a fetch again. This is expected to be fixed in a future Git
2298 version.</p></div>
2299 </div>
2300 </div>
2301 <div class="sect1">
2302 <h2 id="_see_also">SEE ALSO</h2>
2303 <div class="sectionbody">
2304 <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>
2305 </div>
2306 </div>
2307 <div class="sect1">
2308 <h2 id="_git">GIT</h2>
2309 <div class="sectionbody">
2310 <div class="paragraph"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
2311 </div>
2312 </div>
2313 </div>
2314 <div id="footnotes"><hr /></div>
2315 <div id="footer">
2316 <div id="footer-text">
2317 Last updated
2318 2024-03-25 17:24:49 PDT
2319 </div>
2320 </div>
2321 </body>
2322 </html>