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">
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 */
14 font-family: Georgia,serif;
18 h1, h2, h3, h4, h5, h6,
19 div.title, caption.title,
20 thead, p.table.header,
22 #author, #revnumber, #revdate, #revremark,
24 font-family: Arial,Helvetica,sans-serif;
28 margin:
1em
5%
1em
5%;
33 text-decoration: underline;
49 h1, h2, h3, h4, h5, h6 {
57 border-bottom:
2px solid silver;
77 border:
1px solid silver;
88 ul
> li { color: #aaa; }
89 ul
> li
> * { color: black; }
91 .monospaced, code, pre {
92 font-family:
"Courier New", Courier, monospace;
99 white-space: pre-wrap;
109 #revnumber, #revdate, #revremark {
114 border-top:
2px solid silver;
120 padding-bottom:
0.5em;
124 padding-bottom:
0.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 {
135 margin-bottom:
1.5em;
137 div.admonitionblock {
139 margin-bottom:
2.0em;
144 div.content { /* Block element content. */
148 /* Block element titles. */
149 div.title, caption.title {
154 margin-bottom:
0.5em;
160 td div.title:first-child {
163 div.content div.title:first-child {
166 div.content + div.title {
170 div.sidebarblock
> div.content {
172 border:
1px solid #dddddd;
173 border-left:
4px solid #f0f0f0;
177 div.listingblock
> div.content {
178 border:
1px solid #dddddd;
179 border-left:
5px solid #f0f0f0;
184 div.quoteblock, div.verseblock {
188 border-left:
5px solid #f0f0f0;
192 div.quoteblock
> div.attribution {
197 div.verseblock
> pre.content {
198 font-family: inherit;
201 div.verseblock
> div.attribution {
205 /* DEPRECATED: Pre version
8.2.7 verse style literal block. */
206 div.verseblock + div.attribution {
210 div.admonitionblock .icon {
214 text-decoration: underline;
216 padding-right:
0.5em;
218 div.admonitionblock td.content {
220 border-left:
3px solid #dddddd;
223 div.exampleblock
> div.content {
224 border-left:
3px solid #dddddd;
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; }
234 margin-bottom:
0.8em;
247 list-style-position: outside;
250 list-style-type: decimal;
253 list-style-type: lower-alpha;
256 list-style-type: upper-alpha;
259 list-style-type: lower-roman;
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 {
269 margin-bottom:
0.1em;
281 margin-bottom:
0.8em;
284 padding-bottom:
15px;
286 dt.hdlist1.strong, td.hdlist1.strong {
292 padding-right:
0.8em;
298 div.hdlist.compact tr {
307 .footnote, .footnoteref {
311 span.footnote, span.footnoteref {
312 vertical-align: super;
316 margin:
20px
0 20px
0;
320 #footnotes div.footnote {
326 border-top:
1px solid silver;
335 padding-right:
0.5em;
336 padding-bottom:
0.3em;
344 #footer-badges { display: none; }
348 margin-bottom:
2.5em;
356 margin-bottom:
0.1em;
359 div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
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; }
427 margin-bottom:
1.5em;
429 div.tableblock
> table {
430 border:
3px solid #
527bbd;
432 thead, p.table.header {
439 /* Because the table frame attribute is overridden by CSS in most browsers. */
440 div.tableblock
> table[
frame=
"void"] {
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;
460 margin-bottom:
1.5em;
462 thead, p.tableblock.header {
473 border-color: #
527bbd;
474 border-collapse: collapse;
476 th.tableblock, td.tableblock {
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 {
498 th.tableblock.halign-center, td.tableblock.halign-center {
501 th.tableblock.halign-right, td.tableblock.halign-right {
505 th.tableblock.valign-top, td.tableblock.valign-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;
523 padding-bottom:
0.5em;
524 border-top:
2px solid silver;
525 border-bottom:
2px solid silver;
530 body.manpage div.sectionbody {
535 body.manpage div#toc { display: none; }
540 <script type=
"text/javascript">
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
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 */
562 toc: function (toclevels) {
564 function getText(el) {
566 for (var i = el.firstChild; i != null; i = i.nextSibling) {
567 if (i.nodeType ==
3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
569 else if (i.firstChild != null)
575 function TocEntry(el, text, toclevel) {
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
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);
602 var toc = document.getElementById(
"toc");
607 // Delete existing TOC entries in case we're reloading the TOC.
608 var tocEntriesToRemove = [];
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");
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.
651 var noteholder = document.getElementById(
"footnotes");
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");
670 for (i=
0; i
<spans.length; i++) {
671 if (spans[i].className ==
"footnote") {
673 var note = spans[i].getAttribute(
"data-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];
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;
692 noteholder.parentNode.removeChild(noteholder);
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.
701 "[<a href='#_footnote_" + n +
702 "' title='View footnote' class='footnote'>" + n +
"</a>]";
708 install: function(toclevels) {
711 function reinstall() {
712 asciidoc.footnotes();
714 asciidoc.toc(toclevels);
718 function reinstallAndRemoveTimer() {
719 clearInterval(timerId);
723 timerId = setInterval(reinstall,
500);
724 if (document.addEventListener)
725 document.addEventListener(
"DOMContentLoaded", reinstallAndRemoveTimer, false);
727 window.onload = reinstallAndRemoveTimer;
735 <body class=
"manpage">
738 git-pull(
1) Manual Page
741 <div class=
"sectionbody">
743 Fetch from and integrate with another repository or a local branch
749 <h2 id=
"_synopsis">SYNOPSIS
</h2>
750 <div class=
"sectionbody">
751 <div class=
"verseblock">
752 <pre class=
"content"><em>git pull
</em> [
<options
>] [
<repository
> [
<refspec
>…]]
</pre>
753 <div class=
"attribution">
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
770 <div class=
"paragraph"><p><repository
> should be the name of a remote repository as
771 passed to
<a href=
"git-fetch.html">git-fetch(
1)
</a>.
<refspec
> 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/
*:refs/remotes/origin/
*),
775 but usually it is the name of a branch in the remote repository.
</p></div>
776 <div class=
"paragraph"><p>Default values for
<repository
> and
<branch
> 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
787 origin/master in your repository
</code></pre>
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>
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>
813 <h2 id=
"_options">OPTIONS
</h2>
814 <div class=
"sectionbody">
815 <div class=
"dlist"><dl>
824 This is passed to both underlying git-fetch to squelch reporting of
825 during transfer, and underlying git-merge to squelch output during
837 Pass --verbose to git-fetch and git-merge.
841 --[no-]recurse-submodules[=yes|on-demand|no]
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>).
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>
855 <h3 id=
"_options_related_to_merging">Options related to merging
</h3>
856 <div class=
"dlist"><dl>
865 Perform the merge and commit the result. This option can
866 be used to override --no-commit.
867 Only useful when merging.
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>
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
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>
901 --cleanup=
<mode
>
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><mode
></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.
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).
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.
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>
948 --gpg-sign[=
<keyid
>]
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>.
970 In addition to branch names, populate the log message with
971 one-line descriptions from at most
<n
> 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.
975 <div class=
"paragraph"><p>With --no-log do not list one-line descriptions from the
976 actual commits being merged.
</p></div>
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
’re committing. For example, it may certify that
989 the committer has the rights to submit the work under the
990 project
’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
’re contributing to
995 understand how the signoffs are used in that project.
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>
1000 <dt class=
"hdlist1">
1003 <dt class=
"hdlist1">
1006 <dt class=
"hdlist1">
1011 Show a diffstat at the end of the merge. The diffstat is also
1012 controlled by the configuration option merge.stat.
1014 <div class=
"paragraph"><p>With -n or --no-stat do not show a diffstat at the end of the
1017 <dt class=
"hdlist1">
1020 <dt class=
"hdlist1">
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).
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>
1038 <dt class=
"hdlist1">
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.
1049 <dt class=
"hdlist1">
1052 <dt class=
"hdlist1">
1053 --strategy=
<strategy
>
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).
1064 <dt class=
"hdlist1">
1067 <dt class=
"hdlist1">
1068 --strategy-option=
<option
>
1072 Pass merge strategy specific option through to the merge
1076 <dt class=
"hdlist1">
1079 <dt class=
"hdlist1">
1080 --no-verify-signatures
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.
1090 <div class=
"paragraph"><p>Only useful when merging.
</p></div>
1092 <dt class=
"hdlist1">
1095 <dt class=
"hdlist1">
1100 Synonyms to --stat and --no-stat; these are deprecated and will be
1101 removed in the future.
1104 <dt class=
"hdlist1">
1107 <dt class=
"hdlist1">
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.
1120 <dt class=
"hdlist1">
1121 --allow-unrelated-histories
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.
1132 <div class=
"paragraph"><p>Only useful when merging.
</p></div>
1134 <dt class=
"hdlist1">
1137 <dt class=
"hdlist1">
1138 --rebase[=false|true|merges|interactive]
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.
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.
<name
>.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">
1159 <div class=
"title">Note
</div>
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>
1168 <dt class=
"hdlist1">
1173 This is shorthand for --rebase=false.
1179 <h3 id=
"_options_related_to_fetching">Options related to fetching
</h3>
1180 <div class=
"dlist"><dl>
1181 <dt class=
"hdlist1">
1186 Fetch all remotes. This overrides the configuration variable
1187 <code>fetch.all
</code>.
1190 <dt class=
"hdlist1">
1193 <dt class=
"hdlist1">
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.
1203 <dt class=
"hdlist1">
1208 Use an atomic transaction to update local refs. Either all refs are
1209 updated, or on error, no refs are updated.
1212 <dt class=
"hdlist1">
1213 --depth=
<depth
>
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=
<depth
></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.
1224 <dt class=
"hdlist1">
1225 --deepen=
<depth
>
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.
1234 <dt class=
"hdlist1">
1235 --shallow-since=
<date
>
1239 Deepen or shorten the history of a shallow repository to
1240 include all reachable commits after
<date
>.
1243 <dt class=
"hdlist1">
1244 --shallow-exclude=
<revision
>
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.
1253 <dt class=
"hdlist1">
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.
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>
1265 <dt class=
"hdlist1">
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
1276 <dt class=
"hdlist1">
1277 --negotiation-tip=
<commit|glob
>
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.
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>
1298 <dt class=
"hdlist1">
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.
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>
1311 <dt class=
"hdlist1">
1316 Show what would be done, without making any changes.
1319 <dt class=
"hdlist1">
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.
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>
1330 <dt class=
"hdlist1">
1333 <dt class=
"hdlist1">
1338 When
<em>git fetch
</em> is used with
<code><src
>:
<dst
></code> refspec, it may
1339 refuse to update the local branch as discussed
1340 in the
<code><refspec
></code> part of the
<a href=
"git-fetch.html">git-fetch(
1)
</a>
1342 This option overrides that check.
1345 <dt class=
"hdlist1">
1348 <dt class=
"hdlist1">
1353 Keep downloaded pack.
1356 <dt class=
"hdlist1">
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>.
1366 <dt class=
"hdlist1">
1369 <dt class=
"hdlist1">
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.
1385 <dt class=
"hdlist1">
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.
<name
>.tagOpt
1394 setting. See
<a href=
"git-config.html">git-config(
1)
</a>.
1397 <dt class=
"hdlist1">
1398 --refmap=
<refspec
>
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><refspec
></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.
1413 <dt class=
"hdlist1">
1416 <dt class=
"hdlist1">
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>).
1429 <dt class=
"hdlist1">
1432 <dt class=
"hdlist1">
1437 Number of parallel children to be used for all forms of fetching.
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>
1446 <dt class=
"hdlist1">
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.
<name
>.merge
</code> and
<code>branch.
<name
>.remote
</code> in
1455 <a href=
"git-config.html">git-config(
1)
</a>.
1458 <dt class=
"hdlist1">
1459 --upload-pack
<upload-pack
>
1463 When given, and the repository to fetch from is handled
1464 by
<em>git fetch-pack
</em>,
<code>--exec=
<upload-pack
></code> is passed to
1465 the command to specify non-default path for the command
1466 run on the other end.
1469 <dt class=
"hdlist1">
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.
1480 <dt class=
"hdlist1">
1483 <dt class=
"hdlist1">
1484 --server-option=
<option
>
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
’s handling of server options, including
1491 unknown ones, is server-specific.
1492 When multiple
<code>--server-option=
<option
></code> are given, they are all
1493 sent to the other side in the order listed on the command line.
1496 <dt class=
"hdlist1">
1497 --show-forced-updates
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>.
1507 <dt class=
"hdlist1">
1508 --no-show-forced-updates
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>.
1519 <dt class=
"hdlist1">
1522 <dt class=
"hdlist1">
1527 Use IPv4 addresses only, ignoring IPv6 addresses.
1530 <dt class=
"hdlist1">
1533 <dt class=
"hdlist1">
1538 Use IPv6 addresses only, ignoring IPv4 addresses.
1541 <dt class=
"hdlist1">
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).
1552 <dt class=
"hdlist1">
1557 Specifies which refs to fetch and which local refs to update.
1558 When no
<refspec
>s appear on the command line, the refs to fetch
1559 are read from
<code>remote.
<repository
>.fetch
</code> variables instead
1560 (see the section
"CONFIGURED REMOTE-TRACKING BRANCHES"
1561 in
<a href=
"git-fetch.html">git-fetch(
1)
</a>).
1563 <div class=
"paragraph"><p>The format of a
<refspec
> parameter is an optional plus
1564 <code>+
</code>, followed by the source
<src
>, followed
1565 by a colon
<code>:
</code>, followed by the destination ref
<dst
>.
1566 The colon can be omitted when
<dst
> is empty.
<src
> is
1567 typically a ref, but it can also be a fully spelled hex object
1569 <div class=
"paragraph"><p>A
<refspec
> may contain a
<code>*
</code> in its
<src
> 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
<refspec
> must have a
<code>*
</code> in both the
<src
> and
1572 <dst
>. 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
<src
> and do not specify a
<dst
>. Fully spelled out hex object
1582 names are also not supported.
</p></div>
1583 <div class=
"paragraph"><p><code>tag
<tag
></code> means the same as
<code>refs/tags/
<tag
>:refs/tags/
<tag
></code>;
1584 it requests fetching everything up to the given tag.
</p></div>
1585 <div class=
"paragraph"><p>The remote ref that matches
<src
>
1586 is fetched, and if
<dst
> 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
’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><refspec
>...
</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
’s swapping e.g. a tree object for a blob, or
1604 a commit for another commit that doesn
’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
’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
’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
1615 <div class=
"admonitionblock">
1618 <div class=
"title">Note
</div>
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>
1632 <div class=
"admonitionblock">
1635 <div class=
"title">Note
</div>
1637 <td class=
"content">There is a difference between listing multiple
<refspec
>
1638 directly on
<em>git pull
</em> command line and having multiple
1639 <code>remote.
<repository
>.fetch
</code> entries in your configuration
1640 for a
<repository
> and running a
1641 <em>git pull
</em> command without any explicit
<refspec
> parameters.
1642 <refspec
>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
<refspec
> parameter on the command line,
<em>git pull
</em>
1647 will fetch all the
<refspec
>s it finds in the
1648 <code>remote.
<repository
>.fetch
</code> configuration and merge
1649 only the first
<refspec
> 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>
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
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>
1677 ssh://
[user@
]host.xz
[:port
]/path/to/repo.git/
1682 git://host.xz
[:port
]/path/to/repo.git/
1687 http
[s
]://host.xz
[:port
]/path/to/repo.git/
1692 ftp
[s
]://host.xz
[:port
]/path/to/repo.git/
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>
1700 [user@
]host.xz:path/to/repo.git/
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
1709 <div class=
"paragraph"><p>The ssh and git protocols additionally support ~username expansion:
</p></div>
1710 <div class=
"ulist"><ul>
1713 ssh://
[user@
]host.xz
[:port
]/~
[user
]/path/to/repo.git/
1718 git://host.xz
[:port
]/~
[user
]/path/to/repo.git/
1723 [user@
]host.xz:/~
[user
]/path/to/repo.git/
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>
1737 file:///path/to/repo.git/
1741 <div class=
"paragraph"><p>These two syntaxes are mostly equivalent, except when cloning, when
1742 the former implies --local option. See
<a href=
"git-clone.html">git-clone(
1)
</a> for
1744 <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
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
’t know how to handle a certain transport protocol, it
1747 attempts to use the
<em>remote-
<transport
></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>
1753 <transport
>::
<address
>
1757 <div class=
"paragraph"><p>where
<address
> 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=
"listingblock">
1765 <div class=
"content">
1766 <pre><code> [url
"<actual-url-base>"]
1767 insteadOf =
<other-url-base
></code></pre>
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>
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=
"listingblock">
1781 <div class=
"content">
1782 <pre><code> [url
"<actual-url-base>"]
1783 pushInsteadOf =
<other-url-base
></code></pre>
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>
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>
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><repository
></code> argument:
</p></div>
1801 <div class=
"ulist"><ul>
1804 a remote in the Git configuration file:
<code>$GIT_DIR/config
</code>,
1809 a file in the
<code>$GIT_DIR/remotes
</code> directory, or
1814 a file in the
<code>$GIT_DIR/branches
</code> directory.
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>
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
"<name>"]
1833 pushurl =
<pushurl
>
1834 push =
<refspec
>
1835 fetch =
<refspec
></code></pre>
1837 <div class=
"paragraph"><p>The
<code><pushurl
></code> is used for pushes only. It is optional and defaults
1838 to
<code><URL
></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>
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:
<refspec
>
1854 Pull:
<refspec
></code></pre>
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>
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> <URL
>#
<head
></code></pre>
1871 <div class=
"paragraph"><p><code><URL
></code> is required;
<code>#
<head
></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
’t provide one on the command line.
1874 <code><branch
></code> is the name of this file in
<code>$GIT_DIR/branches
</code> and
1875 <code><head
></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/
<head
>:refs/heads/
<branch
></code></pre>
1881 <div class=
"paragraph"><p>git push uses:
</p></div>
1882 <div class=
"listingblock">
1883 <div class=
"content">
1884 <pre><code> HEAD:refs/heads/
<head
></code></pre>
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
<option
></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">
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’s Twin") and came from the fact that it
1914 was written as a replacement for the previous default
1915 algorithm,
<code>recursive
</code>.
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">
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.
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>
1933 <dt class=
"hdlist1">
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.
1942 <dt class=
"hdlist1">
1945 <dt class=
"hdlist1">
1948 <dt class=
"hdlist1">
1951 <dt class=
"hdlist1">
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>.
1962 <div class=
"ulist"><ul>
1965 If
<em>their
</em> version only introduces whitespace changes to a line,
1966 <em>our
</em> version is used;
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;
1977 Otherwise, the merge proceeds in the usual way.
1982 <dt class=
"hdlist1">
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.
1995 <dt class=
"hdlist1">
2000 Disables the
<code>renormalize
</code> option. This overrides the
2001 <code>merge.renormalize
</code> configuration variable.
2004 <dt class=
"hdlist1">
2005 find-renames[=
<n
>]
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>.
2015 <dt class=
"hdlist1">
2016 rename-threshold=
<n
>
2020 Deprecated synonym for
<code>find-renames=
<n
></code>.
2023 <dt class=
"hdlist1">
2024 subtree[=
<path
>]
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
2037 <dt class=
"hdlist1">
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
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">
2064 Deprecated synonym for
<code>diff-algorithm=patience
</code>.
2067 <dt class=
"hdlist1">
2068 diff-algorithm=[patience|minimal|histogram|myers]
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.
2080 <dt class=
"hdlist1">
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>.
2092 <dt class=
"hdlist1">
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.
2103 <dt class=
"hdlist1">
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.
2115 <dt class=
"hdlist1">
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.
2128 <dt class=
"hdlist1">
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
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>
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.
<name
>.remote
</code> is
2156 present while on branch
<code><name
></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.
<origin
>.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/
<origin
></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.
<origin
>.fetch
</code> are
2166 consulted, and if there aren
’t any,
<code>$GIT_DIR/remotes/
<origin
></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>
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/
<origin
></code>. In such cases, the following
2187 rules apply:
</p></div>
2188 <div class=
"olist arabic"><ol class=
"arabic">
2191 If
<code>branch.
<name
>.merge
</code> configuration for the current
2192 branch
<code><name
></code> exists, that is the name of the branch at the
2193 remote site that is merged.
2198 If the refspec is a globbing one, nothing is merged.
2203 Otherwise the remote branch of the first refspec is merged.
2210 <h2 id=
"_examples">EXAMPLES
</h2>
2211 <div class=
"sectionbody">
2212 <div class=
"ulist"><ul>
2215 Update the remote-tracking branches for the repository
2216 you cloned from, then merge one of them into your
2219 <div class=
"listingblock">
2220 <div class=
"content">
2221 <pre><code>$ git pull
2222 $ git pull origin
</code></pre>
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.
<name
>.remote and
2226 branch.
<name
>.merge options; see
<a href=
"git-config.html">git-config(
1)
</a> for details.
</p></div>
2230 Merge into the current branch the remote branch
<code>next
</code>:
2232 <div class=
"listingblock">
2233 <div class=
"content">
2234 <pre><code>$ git pull origin next
</code></pre>
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>
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>
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">
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
’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.)
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.
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
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>
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>
2314 <div id=
"footnotes"><hr /></div>
2316 <div id=
"footer-text">
2318 2021-
10-
18 17:
00:
13 PDT