1 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:
lang=
"en">
5 <meta http-equiv=
"Content-Type" content=
"text/html; charset=UTF-8" />
6 <meta name=
"generator" content=
"AsciiDoc 8.5.2" />
7 <title>git-pull(
1)
</title>
8 <style type=
"text/css">
10 p
, li
, dt
, dd
, div
, pre
, h1
, h2
, h3
, h4
, h5
, h6
{
12 border: 1px solid red;
17 margin: 1em 5% 1em 5%;
22 text-decoration: underline
;
42 h1
, h2
, h3
, h4
, h5
, h6
{
44 font-family: sans-serif
;
51 border-bottom: 2px solid silver
;
69 border: 1px solid silver
;
88 font-family: sans-serif
;
94 span#revnumber
, span#revdate
, span#revremark
{
95 font-family: sans-serif
;
99 font-family: sans-serif
;
101 border-top: 2px solid silver
;
107 padding-bottom: 0.5em;
111 padding-bottom: 0.5em;
116 margin-bottom: 1.5em;
118 div
.tableblock
, div
.imageblock
, div
.exampleblock
, div
.verseblock
,
119 div
.quoteblock
, div
.literalblock
, div
.listingblock
, div
.sidebarblock
,
120 div
.admonitionblock
{
122 margin-bottom: 1.5em;
124 div
.admonitionblock
{
126 margin-bottom: 2.0em;
131 div
.content
{ /* Block element content. */
135 /* Block element titles. */
136 div
.title
, caption
.title
{
138 font-family: sans-serif
;
142 margin-bottom: 0.5em;
148 td div
.title:first-child
{
151 div
.content div
.title:first-child
{
154 div
.content
+ div
.title
{
158 div
.sidebarblock
> div
.content
{
160 border: 1px solid silver
;
164 div
.listingblock
> div
.content
{
165 border: 1px solid silver
;
170 div
.quoteblock
, div
.verseblock
{
174 border-left: 5px solid
#dddddd;
178 div
.quoteblock
> div
.attribution
{
183 div
.verseblock
> div
.content
{
186 div
.verseblock
> div
.attribution
{
190 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
191 div
.verseblock
+ div
.attribution
{
195 div
.admonitionblock
.icon
{
199 text-decoration: underline
;
201 padding-right: 0.5em;
203 div
.admonitionblock td
.content
{
205 border-left: 3px solid
#dddddd;
208 div
.exampleblock
> div
.content
{
209 border-left: 3px solid
#dddddd;
213 div
.imageblock div
.content
{ padding-left: 0; }
214 span
.image img
{ border-style: none
; }
215 a
.image:visited
{ color: white
; }
219 margin-bottom: 0.8em;
232 list-style-position: outside
;
235 list-style-type: decimal
;
238 list-style-type: lower-alpha
;
241 list-style-type: upper-alpha
;
244 list-style-type: lower-roman
;
247 list-style-type: upper-roman
;
250 div
.compact ul
, div
.compact ol
,
251 div
.compact p
, div
.compact p
,
252 div
.compact div
, div
.compact div
{
254 margin-bottom: 0.1em;
257 div
.tableblock
> table
{
258 border: 3px solid
#527bbd;
260 thead
, p
.table
.header
{
261 font-family: sans-serif
;
273 /* Because the table frame attribute is overriden by CSS in most browsers. */
274 div
.tableblock
> table
[frame
="void"] {
277 div
.tableblock
> table
[frame
="hsides"] {
278 border-left-style: none
;
279 border-right-style: none
;
281 div
.tableblock
> table
[frame
="vsides"] {
282 border-top-style: none
;
283 border-bottom-style: none
;
289 margin-bottom: 0.8em;
292 padding-bottom: 15px;
294 dt
.hdlist1
.strong
, td
.hdlist1
.strong
{
300 padding-right: 0.8em;
306 div
.hdlist
.compact tr
{
315 .footnote, .footnoteref {
319 span
.footnote
, span
.footnoteref
{
320 vertical-align: super
;
324 margin: 20px 0 20px 0;
328 #footnotes div
.footnote
{
334 border-top: 1px solid silver
;
344 div#footer-badges
{ display: none
; }
348 margin-bottom: 2.5em;
353 font-family: sans-serif
;
357 margin-bottom: 0.1em;
360 div
.toclevel1
, div
.toclevel2
, div
.toclevel3
, div
.toclevel4
{
376 /* Overrides for manpage documents */
379 padding-bottom: 0.5em;
380 border-top: 2px solid silver
;
381 border-bottom: 2px solid silver
;
391 div#toc
{ display: none
; }
394 /* Workarounds for IE6's broken and incomplete CSS2. */
396 div
.sidebar-content
{
398 border: 1px solid silver
;
401 div
.sidebar-title
, div
.image-title
{
403 font-family: sans-serif
;
406 margin-bottom: 0.5em;
409 div
.listingblock div
.content
{
410 border: 1px solid silver
;
415 div
.quoteblock-attribution
{
420 div
.verseblock-content
{
423 div
.verseblock-attribution
{
428 div
.exampleblock-content
{
429 border-left: 3px solid
#dddddd;
433 /* IE6 sets dynamically generated links as visited. */
434 div#toc
a:visited
{ color: blue
; }
436 <script type=
"text/javascript">
438 window
.onload = function(){asciidoc
.footnotes();}
439 var asciidoc
= { // Namespace.
441 /////////////////////////////////////////////////////////////////////
442 // Table Of Contents generator
443 /////////////////////////////////////////////////////////////////////
445 /* Author: Mihai Bazon, September 2002
446 * http://students.infoiasi.ro/~mishoo
448 * Table Of Content generator
451 * Feel free to use this script under the terms of the GNU General Public
452 * License, as long as you do not remove or alter this notice.
455 /* modified by Troy D. Hanson, September 2006. License: GPL */
456 /* modified by Stuart Rackham, 2006, 2009. License: GPL */
459 toc: function (toclevels
) {
461 function getText(el
) {
463 for (var i
= el
.firstChild
; i
!= null; i
= i
.nextSibling
) {
464 if (i
.nodeType
== 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
466 else if (i
.firstChild
!= null)
472 function TocEntry(el
, text
, toclevel
) {
475 this.toclevel
= toclevel
;
478 function tocEntries(el
, toclevels
) {
479 var result
= new Array
;
480 var re
= new RegExp('[hH]([2-'+(toclevels
+1)+'])');
481 // Function that scans the DOM tree for header elements (the DOM2
482 // nodeIterator API would be a better technique but not supported by all
484 var iterate = function (el
) {
485 for (var i
= el
.firstChild
; i
!= null; i
= i
.nextSibling
) {
486 if (i
.nodeType
== 1 /* Node.ELEMENT_NODE */) {
487 var mo
= re
.exec(i
.tagName
);
488 if (mo
&& (i
.getAttribute("class") || i
.getAttribute("className")) != "float") {
489 result
[result
.length
] = new TocEntry(i
, getText(i
), mo
[1]-1);
499 var toc
= document
.getElementById("toc");
500 var entries
= tocEntries(document
.getElementById("content"), toclevels
);
501 for (var i
= 0; i
< entries
.length
; ++i
) {
502 var entry
= entries
[i
];
503 if (entry
.element
.id
== "")
504 entry
.element
.id
= "_toc_" + i
;
505 var a
= document
.createElement("a");
506 a
.href
= "#" + entry
.element
.id
;
507 a
.appendChild(document
.createTextNode(entry
.text
));
508 var div
= document
.createElement("div");
510 div
.className
= "toclevel" + entry
.toclevel
;
511 toc
.appendChild(div
);
513 if (entries
.length
== 0)
514 toc
.parentNode
.removeChild(toc
);
518 /////////////////////////////////////////////////////////////////////
519 // Footnotes generator
520 /////////////////////////////////////////////////////////////////////
522 /* Based on footnote generation code from:
523 * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
526 footnotes: function () {
527 var cont
= document
.getElementById("content");
528 var noteholder
= document
.getElementById("footnotes");
529 var spans
= cont
.getElementsByTagName("span");
532 for (i
=0; i
<spans
.length
; i
++) {
533 if (spans
[i
].className
== "footnote") {
535 // Use [\s\S] in place of . so multi-line matches work.
536 // Because JavaScript has no s (dotall) regex flag.
537 note
= spans
[i
].innerHTML
.match(/\s*\[([\s\S]*)]\s*/)[1];
538 noteholder
.innerHTML
+=
539 "<div class='footnote' id='_footnote_" + n
+ "'>" +
540 "<a href='#_footnoteref_" + n
+ "' title='Return to text'>" +
541 n
+ "</a>. " + note
+ "</div>";
543 "[<a id='_footnoteref_" + n
+ "' href='#_footnote_" + n
+
544 "' title='View footnote' class='footnote'>" + n
+ "</a>]";
545 var id
=spans
[i
].getAttribute("id");
546 if (id
!= null) refs
["#"+id
] = n
;
550 noteholder
.parentNode
.removeChild(noteholder
);
552 // Process footnoterefs.
553 for (i
=0; i
<spans
.length
; i
++) {
554 if (spans
[i
].className
== "footnoteref") {
555 var href
= spans
[i
].getElementsByTagName("a")[0].getAttribute("href");
556 href
= href
.match(/#.*/)[0]; // Because IE return full URL.
559 "[<a href='#_footnote_" + n
+
560 "' title='View footnote' class='footnote'>" + n
+ "</a>]";
573 git-pull(
1) Manual Page
576 <div class=
"sectionbody">
578 Fetch from and merge with another repository or a local branch
583 <h2 id=
"_synopsis">SYNOPSIS
</h2>
584 <div class=
"sectionbody">
585 <div class=
"verseblock">
586 <div class=
"verseblock-content"><em>git pull
</em> [options] [
<repository
> [
<refspec
>…]]
</div>
587 <div class=
"verseblock-attribution">
590 <h2 id=
"_description">DESCRIPTION
</h2>
591 <div class=
"sectionbody">
592 <div class=
"paragraph"><p>Incorporates changes from a remote repository into the current
593 branch. In its default mode,
<tt>git pull
</tt> is shorthand for
594 <tt>git fetch
</tt> followed by
<tt>git merge FETCH_HEAD
</tt>.
</p></div>
595 <div class=
"paragraph"><p>More precisely,
<em>git pull
</em> runs
<em>git fetch
</em> with the given
596 parameters and calls
<em>git merge
</em> to merge the retrieved branch
597 heads into the current branch.
598 With
<tt>--rebase
</tt>, it runs
<em>git rebase
</em> instead of
<em>git merge
</em>.
</p></div>
599 <div class=
"paragraph"><p><repository
> should be the name of a remote repository as
600 passed to
<a href=
"git-fetch.html">git-fetch(
1)
</a>.
<refspec
> can name an
601 arbitrary remote ref (for example, the name of a tag) or even
602 a collection of refs with corresponding remote-tracking branches
603 (e.g., refs/heads/
*:refs/remotes/origin/
*),
604 but usually it is the name of a branch in the remote repository.
</p></div>
605 <div class=
"paragraph"><p>Default values for
<repository
> and
<branch
> are read from the
606 "remote" and
"merge" configuration for the current branch
607 as set by
<a href=
"git-branch.html">git-branch(
1)
</a> <tt>--track
</tt>.
</p></div>
608 <div class=
"paragraph"><p>Assume the following history exists and the current branch is
609 "<tt>master</tt>":
</p></div>
610 <div class=
"listingblock">
611 <div class=
"content">
612 <pre><tt> A---B---C master on origin
614 D---E---F---G master
</tt></pre>
616 <div class=
"paragraph"><p>Then
"<tt>git pull</tt>" will fetch and replay the changes from the remote
617 <tt>master
</tt> branch since it diverged from the local
<tt>master
</tt> (i.e.,
<tt>E
</tt>)
618 until its current commit (
<tt>C
</tt>) on top of
<tt>master
</tt> and record the
619 result in a new commit along with the names of the two parent commits
620 and a log message from the user describing the changes.
</p></div>
621 <div class=
"listingblock">
622 <div class=
"content">
623 <pre><tt> A---B---C remotes/origin/master
625 D---E---F---G---H master
</tt></pre>
627 <div class=
"paragraph"><p>See
<a href=
"git-merge.html">git-merge(
1)
</a> for details, including how conflicts
628 are presented and handled.
</p></div>
629 <div class=
"paragraph"><p>In git
1.7.0 or later, to cancel a conflicting merge, use
630 <tt>git reset --merge
</tt>.
<strong>Warning
</strong>: In older versions of git, running
<em>git pull
</em>
631 with uncommitted changes is discouraged: while possible, it leaves you
632 in a state that may be hard to back out of in the case of a conflict.
</p></div>
633 <div class=
"paragraph"><p>If any of the remote changes overlap with local uncommitted changes,
634 the merge will be automatically cancelled and the work tree untouched.
635 It is generally best to get any local changes in working order before
636 pulling or stash them away with
<a href=
"git-stash.html">git-stash(
1)
</a>.
</p></div>
638 <h2 id=
"_options">OPTIONS
</h2>
639 <div class=
"sectionbody">
640 <div class=
"paragraph"><p>Options meant for
<em>git pull
</em> itself and the underlying
<em>git merge
</em>
641 must be given before the options meant for
<em>git fetch
</em>.
</p></div>
642 <div class=
"dlist"><dl>
651 This is passed to both underlying git-fetch to squelch reporting of
652 during transfer, and underlying git-merge to squelch output during
664 Pass --verbose to git-fetch and git-merge.
668 --[no-]recurse-submodules[=yes|on-demand|no]
672 This option controls if new commits of all populated submodules should
673 be fetched too (see
<a href=
"git-config.html">git-config(
1)
</a> and
<a href=
"gitmodules.html">gitmodules(
5)
</a>).
674 That might be necessary to get the data needed for merging submodule
675 commits, a feature git learned in
1.7.3. Notice that the result of a
676 merge will not be checked out in the submodule,
"git submodule update"
677 has to be called afterwards to bring the work tree up to date with the
682 <h3 id=
"_options_related_to_merging">Options related to merging
</h3><div style=
"clear:left"></div>
683 <div class=
"dlist"><dl>
692 Perform the merge and commit the result. This option can
693 be used to override --no-commit.
695 <div class=
"paragraph"><p>With --no-commit perform the merge but pretend the merge
696 failed and do not autocommit, to give the user a chance to
697 inspect and further tweak the merge result before committing.
</p></div>
706 <div class=
"literalblock">
707 <div class=
"content">
708 <pre><tt>Invoke editor before committing successful merge to further
709 edit the default merge message.
</tt></pre>
720 Do not generate a merge commit if the merge resolved as
721 a fast-forward, only update the branch pointer. This is
722 the default behavior of git-merge.
724 <div class=
"paragraph"><p>With --no-ff Generate a merge commit even if the merge
725 resolved as a fast-forward.
</p></div>
735 In addition to branch names, populate the log message with
736 one-line descriptions from at most
<n
> actual commits that are being
737 merged. See also
<a href=
"git-fmt-merge-msg.html">git-fmt-merge-msg(
1)
</a>.
739 <div class=
"paragraph"><p>With --no-log do not list one-line descriptions from the
740 actual commits being merged.
</p></div>
753 Show a diffstat at the end of the merge. The diffstat is also
754 controlled by the configuration option merge.stat.
756 <div class=
"paragraph"><p>With -n or --no-stat do not show a diffstat at the end of the
767 Produce the working tree and index state as if a real
768 merge happened (except for the merge information),
769 but do not actually make a commit or
770 move the
<tt>HEAD
</tt>, nor record
<tt>$GIT_DIR/MERGE_HEAD
</tt> to
771 cause the next
<tt>git commit
</tt> command to create a merge
772 commit. This allows you to create a single commit on
773 top of the current branch whose effect is the same as
774 merging another branch (or more in case of an octopus).
776 <div class=
"paragraph"><p>With --no-squash perform the merge and commit the result. This
777 option can be used to override --squash.
</p></div>
784 Refuse to merge and exit with a non-zero status unless the
785 current
<tt>HEAD
</tt> is already up-to-date or the merge can be
786 resolved as a fast-forward.
793 --strategy=
<strategy
>
797 Use the given merge strategy; can be supplied more than
798 once to specify them in the order they should be tried.
799 If there is no
<tt>-s
</tt> option, a built-in list of strategies
800 is used instead (
<em>git merge-recursive
</em> when merging a single
801 head,
<em>git merge-octopus
</em> otherwise).
808 --strategy-option=
<option
>
812 Pass merge strategy specific option through to the merge
824 Synonyms to --stat and --no-stat; these are deprecated and will be
825 removed in the future.
836 Operate quietly. Implies --no-progress.
858 Turn progress on/off explicitly. If neither is specified,
859 progress is shown if standard error is connected to a terminal.
860 Note that not all merge strategies may support progress
865 <div class=
"dlist"><dl>
871 Rebase the current branch on top of the upstream branch after
872 fetching. If there is a remote-tracking branch corresponding to
873 the upstream branch and the upstream branch was rebased since last
874 fetched, the rebase uses that information to avoid rebasing
877 <div class=
"paragraph"><p>See
<tt>branch.
<name
>.rebase
</tt> and
<tt>branch.autosetuprebase
</tt> in
878 <a href=
"git-config.html">git-config(
1)
</a> if you want to make
<tt>git pull
</tt> always use
879 <tt>--rebase
</tt> instead of merging.
</p></div>
880 <div class=
"admonitionblock">
883 <div class=
"title">Note
</div>
885 <td class=
"content">This is a potentially
<em>dangerous
</em> mode of operation.
886 It rewrites history, which does not bode well when you
887 published that history already. Do
<strong>not
</strong> use this option
888 unless you have read
<a href=
"git-rebase.html">git-rebase(
1)
</a> carefully.
</td>
897 Override earlier --rebase.
901 <h3 id=
"_options_related_to_fetching">Options related to fetching
</h3><div style=
"clear:left"></div>
902 <div class=
"dlist"><dl>
919 Append ref names and object names of fetched refs to the
920 existing contents of
<tt>.git/FETCH_HEAD
</tt>. Without this
921 option old data in
<tt>.git/FETCH_HEAD
</tt> will be overwritten.
925 --depth=
<depth
>
929 Deepen the history of a
<em>shallow
</em> repository created by
930 <tt>git clone
</tt> with
<tt>--depth=
<depth
></tt> option (see
<a href=
"git-clone.html">git-clone(
1)
</a>)
931 by the specified number of commits.
942 When
<em>git fetch
</em> is used with
<tt><rbranch
>:
<lbranch
></tt>
943 refspec, it refuses to update the local branch
944 <tt><lbranch
></tt> unless the remote branch
<tt><rbranch
></tt> it
945 fetches is a descendant of
<tt><lbranch
></tt>. This option
946 overrides that check.
957 Keep downloaded pack.
965 By default, tags that point at objects that are downloaded
966 from the remote repository are fetched and stored locally.
967 This option disables this automatic tag following. The default
968 behavior for a remote may be specified with the remote.
<name
>.tagopt
969 setting. See
<a href=
"git-config.html">git-config(
1)
</a>.
980 By default
<em>git fetch
</em> refuses to update the head which
981 corresponds to the current branch. This flag disables the
982 check. This is purely for the internal use for
<em>git pull
</em>
983 to communicate with
<em>git fetch
</em>, and unless you are
984 implementing your own Porcelain you are not supposed to
989 --upload-pack
<upload-pack
>
993 When given, and the repository to fetch from is handled
994 by
<em>git fetch-pack
</em>,
<em>--exec=
<upload-pack
></em> is passed to
995 the command to specify non-default path for the command
996 run on the other end.
1004 Progress status is reported on the standard error stream
1005 by default when it is attached to a terminal, unless -q
1006 is specified. This flag forces progress status even if the
1007 standard error stream is not directed to a terminal.
1010 <dt class=
"hdlist1">
1015 The
"remote" repository that is the source of a fetch
1016 or pull operation. This parameter can be either a URL
1017 (see the section
<a href=
"#URLS">GIT URLS
</a> below) or the name
1018 of a remote (see the section
<a href=
"#REMOTES">REMOTES
</a> below).
1021 <dt class=
"hdlist1">
1026 The format of a
<refspec
> parameter is an optional plus
1027 <tt>+</tt>, followed by the source ref
<src
>, followed
1028 by a colon
<tt>:
</tt>, followed by the destination ref
<dst
>.
1030 <div class=
"paragraph"><p>The remote ref that matches
<src
>
1031 is fetched, and if
<dst
> is not empty string, the local
1032 ref that matches it is fast-forwarded using
<src
>.
1033 If the optional plus
<tt>+
</tt> is used, the local ref
1034 is updated even if it does not result in a fast-forward
1036 <div class=
"admonitionblock">
1039 <div class=
"title">Note
</div>
1041 <td class=
"content">If the remote branch from which you want to pull is
1042 modified in non-linear ways such as being rewound and
1043 rebased frequently, then a pull will attempt a merge with
1044 an older version of itself, likely conflict, and fail.
1045 It is under these conditions that you would want to use
1046 the
<tt>+
</tt> sign to indicate non-fast-forward updates will
1047 be needed. There is currently no easy way to determine
1048 or declare that a branch will be made available in a
1049 repository with this behavior; the pulling user simply
1050 must know this is the expected usage pattern for a branch.
</td>
1053 <div class=
"admonitionblock">
1056 <div class=
"title">Note
</div>
1058 <td class=
"content">You never do your own development on branches that appear
1059 on the right hand side of a
<refspec
> colon on
<tt>Pull:
</tt> lines;
1060 they are to be updated by
<em>git fetch
</em>. If you intend to do
1061 development derived from a remote branch
<tt>B
</tt>, have a
<tt>Pull:
</tt>
1062 line to track it (i.e.
<tt>Pull: B:remote-B
</tt>), and have a separate
1063 branch
<tt>my-B
</tt> to do your development on top of it. The latter
1064 is created by
<tt>git branch my-B remote-B
</tt> (or its equivalent
<tt>git
1065 checkout -b my-B remote-B
</tt>). Run
<tt>git fetch
</tt> to keep track of
1066 the progress of the remote side, and when you see something new
1067 on the remote branch, merge it into your development branch with
1068 <tt>git pull . remote-B
</tt>, while you are on
<tt>my-B
</tt> branch.
</td>
1071 <div class=
"admonitionblock">
1074 <div class=
"title">Note
</div>
1076 <td class=
"content">There is a difference between listing multiple
<refspec
>
1077 directly on
<em>git pull
</em> command line and having multiple
1078 <tt>Pull:
</tt> <refspec
> lines for a
<repository
> and running
1079 <em>git pull
</em> command without any explicit
<refspec
> parameters.
1080 <refspec
> listed explicitly on the command line are always
1081 merged into the current branch after fetching. In other words,
1082 if you list more than one remote refs, you would be making
1083 an Octopus. While
<em>git pull
</em> run without any explicit
<refspec
>
1084 parameter takes default
<refspec
>s from
<tt>Pull:
</tt> lines, it
1085 merges only the first
<refspec
> found into the current branch,
1086 after fetching all the remote refs. This is because making an
1087 Octopus from remote refs is rarely done, while keeping track
1088 of multiple remote heads in one-go by fetching more than one
1089 is often useful.
</td>
1092 <div class=
"paragraph"><p>Some short-cut notations are also supported.
</p></div>
1093 <div class=
"ulist"><ul>
1096 <tt>tag
<tag
></tt> means the same as
<tt>refs/tags/
<tag
>:refs/tags/
<tag
></tt>;
1097 it requests fetching everything up to the given tag.
1102 A parameter
<ref
> without a colon is equivalent to
1103 <ref
>: when pulling/fetching, so it merges
<ref
> into the current
1104 branch without storing the remote branch anywhere locally
1111 <h2 id=
"_git_urls_a_id_urls_a">GIT URLS
<a id=
"URLS"></a></h2>
1112 <div class=
"sectionbody">
1113 <div class=
"paragraph"><p>In general, URLs contain information about the transport protocol, the
1114 address of the remote server, and the path to the repository.
1115 Depending on the transport protocol, some of this information may be
1117 <div class=
"paragraph"><p>Git natively supports ssh, git, http, https, ftp, ftps, and rsync
1118 protocols. The following syntaxes may be used with them:
</p></div>
1119 <div class=
"ulist"><ul>
1122 ssh://
[user@
]host.xz
[:port
]/path/to/repo.git/
1127 git://host.xz
[:port
]/path/to/repo.git/
1132 http
[s
]://host.xz
[:port
]/path/to/repo.git/
1137 ftp
[s
]://host.xz
[:port
]/path/to/repo.git/
1142 rsync://host.xz/path/to/repo.git/
1146 <div class=
"paragraph"><p>An alternative scp-like syntax may also be used with the ssh protocol:
</p></div>
1147 <div class=
"ulist"><ul>
1150 [user@
]host.xz:path/to/repo.git/
1154 <div class=
"paragraph"><p>The ssh and git protocols additionally support ~username expansion:
</p></div>
1155 <div class=
"ulist"><ul>
1158 ssh://
[user@
]host.xz
[:port
]/~
[user
]/path/to/repo.git/
1163 git://host.xz
[:port
]/~
[user
]/path/to/repo.git/
1168 [user@
]host.xz:/~
[user
]/path/to/repo.git/
1172 <div class=
"paragraph"><p>For local repositories, also supported by git natively, the following
1173 syntaxes may be used:
</p></div>
1174 <div class=
"ulist"><ul>
1182 <a href=
"file:///path/to/repo.git/">file:///path/to/repo.git/
</a>
1186 <div class=
"paragraph"><p>These two syntaxes are mostly equivalent, except when cloning, when
1187 the former implies --local option. See
<a href=
"git-clone.html">git-clone(
1)
</a> for
1189 <div class=
"paragraph"><p>When git doesn
’t know how to handle a certain transport protocol, it
1190 attempts to use the
<em>remote-
<transport
></em> remote helper, if one
1191 exists. To explicitly request a remote helper, the following syntax
1192 may be used:
</p></div>
1193 <div class=
"ulist"><ul>
1196 <transport
>::
<address
>
1200 <div class=
"paragraph"><p>where
<address
> may be a path, a server and path, or an arbitrary
1201 URL-like string recognized by the specific remote helper being
1202 invoked. See
<a href=
"git-remote-helpers.html">git-remote-helpers(
1)
</a> for details.
</p></div>
1203 <div class=
"paragraph"><p>If there are a large number of similarly-named remote repositories and
1204 you want to use a different format for them (such that the URLs you
1205 use will be rewritten into URLs that work), you can create a
1206 configuration section of the form:
</p></div>
1207 <div class=
"listingblock">
1208 <div class=
"content">
1209 <pre><tt> [url
"<actual url base>"]
1210 insteadOf =
<other url base
></tt></pre>
1212 <div class=
"paragraph"><p>For example, with this:
</p></div>
1213 <div class=
"listingblock">
1214 <div class=
"content">
1215 <pre><tt> [url
"git://git.host.xz/"]
1216 insteadOf = host.xz:/path/to/
1217 insteadOf = work:
</tt></pre>
1219 <div class=
"paragraph"><p>a URL like
"work:repo.git" or like
"host.xz:/path/to/repo.git" will be
1220 rewritten in any context that takes a URL to be
"git://git.host.xz/repo.git".
</p></div>
1221 <div class=
"paragraph"><p>If you want to rewrite URLs for push only, you can create a
1222 configuration section of the form:
</p></div>
1223 <div class=
"listingblock">
1224 <div class=
"content">
1225 <pre><tt> [url
"<actual url base>"]
1226 pushInsteadOf =
<other url base
></tt></pre>
1228 <div class=
"paragraph"><p>For example, with this:
</p></div>
1229 <div class=
"listingblock">
1230 <div class=
"content">
1231 <pre><tt> [url
"ssh://example.org/"]
1232 pushInsteadOf = git://example.org/
</tt></pre>
1234 <div class=
"paragraph"><p>a URL like
"git://example.org/path/to/repo.git" will be rewritten to
1235 "ssh://example.org/path/to/repo.git" for pushes, but pulls will still
1236 use the original URL.
</p></div>
1238 <h2 id=
"_remotes_a_id_remotes_a">REMOTES
<a id=
"REMOTES"></a></h2>
1239 <div class=
"sectionbody">
1240 <div class=
"paragraph"><p>The name of one of the following can be used instead
1241 of a URL as
<tt><repository
></tt> argument:
</p></div>
1242 <div class=
"ulist"><ul>
1245 a remote in the git configuration file:
<tt>$GIT_DIR/config
</tt>,
1250 a file in the
<tt>$GIT_DIR/remotes
</tt> directory, or
1255 a file in the
<tt>$GIT_DIR/branches
</tt> directory.
1259 <div class=
"paragraph"><p>All of these also allow you to omit the refspec from the command line
1260 because they each contain a refspec which git will use by default.
</p></div>
1261 <h3 id=
"_named_remote_in_configuration_file">Named remote in configuration file
</h3><div style=
"clear:left"></div>
1262 <div class=
"paragraph"><p>You can choose to provide the name of a remote which you had previously
1263 configured using
<a href=
"git-remote.html">git-remote(
1)
</a>,
<a href=
"git-config.html">git-config(
1)
</a>
1264 or even by a manual edit to the
<tt>$GIT_DIR/config
</tt> file. The URL of
1265 this remote will be used to access the repository. The refspec
1266 of this remote will be used by default when you do
1267 not provide a refspec on the command line. The entry in the
1268 config file would appear like this:
</p></div>
1269 <div class=
"listingblock">
1270 <div class=
"content">
1271 <pre><tt> [remote
"<name>"]
1273 pushurl =
<pushurl
>
1274 push =
<refspec
>
1275 fetch =
<refspec
></tt></pre>
1277 <div class=
"paragraph"><p>The
<tt><pushurl
></tt> is used for pushes only. It is optional and defaults
1278 to
<tt><url
></tt>.
</p></div>
1279 <h3 id=
"_named_file_in_tt_git_dir_remotes_tt">Named file in
<tt>$GIT_DIR/remotes
</tt></h3><div style=
"clear:left"></div>
1280 <div class=
"paragraph"><p>You can choose to provide the name of a
1281 file in
<tt>$GIT_DIR/remotes
</tt>. The URL
1282 in this file will be used to access the repository. The refspec
1283 in this file will be used as default when you do not
1284 provide a refspec on the command line. This file should have the
1285 following format:
</p></div>
1286 <div class=
"listingblock">
1287 <div class=
"content">
1288 <pre><tt> URL: one of the above URL format
1289 Push:
<refspec
>
1290 Pull:
<refspec
></tt></pre>
1292 <div class=
"paragraph"><p><tt>Push:
</tt> lines are used by
<em>git push
</em> and
1293 <tt>Pull:
</tt> lines are used by
<em>git pull
</em> and
<em>git fetch
</em>.
1294 Multiple
<tt>Push:
</tt> and
<tt>Pull:
</tt> lines may
1295 be specified for additional branch mappings.
</p></div>
1296 <h3 id=
"_named_file_in_tt_git_dir_branches_tt">Named file in
<tt>$GIT_DIR/branches
</tt></h3><div style=
"clear:left"></div>
1297 <div class=
"paragraph"><p>You can choose to provide the name of a
1298 file in
<tt>$GIT_DIR/branches
</tt>.
1299 The URL in this file will be used to access the repository.
1300 This file should have the following format:
</p></div>
1301 <div class=
"listingblock">
1302 <div class=
"content">
1303 <pre><tt> <url
>#
<head
></tt></pre>
1305 <div class=
"paragraph"><p><tt><url
></tt> is required;
<tt>#
<head
></tt> is optional.
</p></div>
1306 <div class=
"paragraph"><p>Depending on the operation, git will use one of the following
1307 refspecs, if you don
’t provide one on the command line.
1308 <tt><branch
></tt> is the name of this file in
<tt>$GIT_DIR/branches
</tt> and
1309 <tt><head
></tt> defaults to
<tt>master
</tt>.
</p></div>
1310 <div class=
"paragraph"><p>git fetch uses:
</p></div>
1311 <div class=
"listingblock">
1312 <div class=
"content">
1313 <pre><tt> refs/heads/
<head
>:refs/heads/
<branch
></tt></pre>
1315 <div class=
"paragraph"><p>git push uses:
</p></div>
1316 <div class=
"listingblock">
1317 <div class=
"content">
1318 <pre><tt> HEAD:refs/heads/
<head
></tt></pre>
1321 <h2 id=
"_merge_strategies">MERGE STRATEGIES
</h2>
1322 <div class=
"sectionbody">
1323 <div class=
"paragraph"><p>The merge mechanism (
<em>git-merge
</em> and
<em>git-pull
</em> commands) allows the
1324 backend
<em>merge strategies
</em> to be chosen with
<tt>-s
</tt> option. Some strategies
1325 can also take their own options, which can be passed by giving
<tt>-X
<option
></tt>
1326 arguments to
<em>git-merge
</em> and/or
<em>git-pull
</em>.
</p></div>
1327 <div class=
"dlist"><dl>
1328 <dt class=
"hdlist1">
1333 This can only resolve two heads (i.e. the current branch
1334 and another branch you pulled from) using a
3-way merge
1335 algorithm. It tries to carefully detect criss-cross
1336 merge ambiguities and is considered generally safe and
1340 <dt class=
"hdlist1">
1345 This can only resolve two heads using a
3-way merge
1346 algorithm. When there is more than one common
1347 ancestor that can be used for
3-way merge, it creates a
1348 merged tree of the common ancestors and uses that as
1349 the reference tree for the
3-way merge. This has been
1350 reported to result in fewer merge conflicts without
1351 causing mis-merges by tests done on actual merge commits
1352 taken from Linux
2.6 kernel development history.
1353 Additionally this can detect and handle merges involving
1354 renames. This is the default merge strategy when
1355 pulling or merging one branch.
1357 <div class=
"paragraph"><p>The
<em>recursive
</em> strategy can take the following options:
</p></div>
1358 <div class=
"dlist"><dl>
1359 <dt class=
"hdlist1">
1364 This option forces conflicting hunks to be auto-resolved cleanly by
1365 favoring
<em>our
</em> version. Changes from the other tree that do not
1366 conflict with our side are reflected to the merge result.
1368 <div class=
"paragraph"><p>This should not be confused with the
<em>ours
</em> merge strategy, which does not
1369 even look at what the other tree contains at all. It discards everything
1370 the other tree did, declaring
<em>our
</em> history contains all that happened in it.
</p></div>
1372 <dt class=
"hdlist1">
1377 This is opposite of
<em>ours
</em>.
1380 <dt class=
"hdlist1">
1385 With this option,
<em>merge-recursive
</em> spends a little extra time
1386 to avoid mismerges that sometimes occur due to unimportant
1387 matching lines (e.g., braces from distinct functions). Use
1388 this when the branches to be merged have diverged wildly.
1389 See also
<a href=
"git-diff.html">git-diff(
1)
</a> <tt>--patience
</tt>.
1392 <dt class=
"hdlist1">
1395 <dt class=
"hdlist1">
1398 <dt class=
"hdlist1">
1403 Treats lines with the indicated type of whitespace change as
1404 unchanged for the sake of a three-way merge. Whitespace
1405 changes mixed with other changes to a line are not ignored.
1406 See also
<a href=
"git-diff.html">git-diff(
1)
</a> <tt>-b
</tt>,
<tt>-w
</tt>, and
1407 <tt>--ignore-space-at-eol
</tt>.
1409 <div class=
"ulist"><ul>
1412 If
<em>their
</em> version only introduces whitespace changes to a line,
1413 <em>our
</em> version is used;
1418 If
<em>our
</em> version introduces whitespace changes but
<em>their
</em>
1419 version includes a substantial change,
<em>their
</em> version is used;
1424 Otherwise, the merge proceeds in the usual way.
1429 <dt class=
"hdlist1">
1434 This runs a virtual check-out and check-in of all three stages
1435 of a file when resolving a three-way merge. This option is
1436 meant to be used when merging branches with different clean
1437 filters or end-of-line normalization rules. See
"Merging
1438 branches with differing checkin/checkout attributes" in
1439 <a href=
"gitattributes.html">gitattributes(
5)
</a> for details.
1442 <dt class=
"hdlist1">
1447 Disables the
<tt>renormalize
</tt> option. This overrides the
1448 <tt>merge.renormalize
</tt> configuration variable.
1451 <dt class=
"hdlist1">
1452 rename-threshold=
<n
>
1456 Controls the similarity threshold used for rename detection.
1457 See also
<a href=
"git-diff.html">git-diff(
1)
</a> <tt>-M
</tt>.
1460 <dt class=
"hdlist1">
1461 subtree[=
<path
>]
1465 This option is a more advanced form of
<em>subtree
</em> strategy, where
1466 the strategy makes a guess on how two trees must be shifted to
1467 match with each other when merging. Instead, the specified path
1468 is prefixed (or stripped from the beginning) to make the shape of
1474 <dt class=
"hdlist1">
1479 This resolves cases with more than two heads, but refuses to do
1480 a complex merge that needs manual resolution. It is
1481 primarily meant to be used for bundling topic branch
1482 heads together. This is the default merge strategy when
1483 pulling or merging more than one branch.
1486 <dt class=
"hdlist1">
1491 This resolves any number of heads, but the resulting tree of the
1492 merge is always that of the current branch head, effectively
1493 ignoring all changes from all other branches. It is meant to
1494 be used to supersede old development history of side
1495 branches. Note that this is different from the -Xours option to
1496 the
<em>recursive
</em> merge strategy.
1499 <dt class=
"hdlist1">
1504 This is a modified recursive strategy. When merging trees A and
1505 B, if B corresponds to a subtree of A, B is first adjusted to
1506 match the tree structure of A, instead of reading the trees at
1507 the same level. This adjustment is also done to the common
1513 <h2 id=
"_default_behaviour">DEFAULT BEHAVIOUR
</h2>
1514 <div class=
"sectionbody">
1515 <div class=
"paragraph"><p>Often people use
<tt>git pull
</tt> without giving any parameter.
1516 Traditionally, this has been equivalent to saying
<tt>git pull
1517 origin
</tt>. However, when configuration
<tt>branch.
<name
>.remote
</tt> is
1518 present while on branch
<tt><name
></tt>, that value is used instead of
1519 <tt>origin
</tt>.
</p></div>
1520 <div class=
"paragraph"><p>In order to determine what URL to use to fetch from, the value
1521 of the configuration
<tt>remote.
<origin
>.url
</tt> is consulted
1522 and if there is not any such variable, the value on
<tt>URL: ` line
1523 in `$GIT_DIR/remotes/
<origin
></tt> file is used.
</p></div>
1524 <div class=
"paragraph"><p>In order to determine what remote branches to fetch (and
1525 optionally store in the remote-tracking branches) when the command is
1526 run without any refspec parameters on the command line, values
1527 of the configuration variable
<tt>remote.
<origin
>.fetch
</tt> are
1528 consulted, and if there aren
’t any,
<tt>$GIT_DIR/remotes/
<origin
></tt>
1529 file is consulted and its `Pull: ` lines are used.
1530 In addition to the refspec formats described in the OPTIONS
1531 section, you can have a globbing refspec that looks like this:
</p></div>
1532 <div class=
"listingblock">
1533 <div class=
"content">
1534 <pre><tt>refs/heads/*:refs/remotes/origin/*
</tt></pre>
1536 <div class=
"paragraph"><p>A globbing refspec must have a non-empty RHS (i.e. must store
1537 what were fetched in remote-tracking branches), and its LHS and RHS
1538 must end with
<tt>/*
</tt>. The above specifies that all remote
1539 branches are tracked using remote-tracking branches in
1540 <tt>refs/remotes/origin/
</tt> hierarchy under the same name.
</p></div>
1541 <div class=
"paragraph"><p>The rule to determine which remote branch to merge after
1542 fetching is a bit involved, in order not to break backward
1543 compatibility.
</p></div>
1544 <div class=
"paragraph"><p>If explicit refspecs were given on the command
1545 line of
<tt>git pull
</tt>, they are all merged.
</p></div>
1546 <div class=
"paragraph"><p>When no refspec was given on the command line, then
<tt>git pull
</tt>
1547 uses the refspec from the configuration or
1548 <tt>$GIT_DIR/remotes/
<origin
></tt>. In such cases, the following
1549 rules apply:
</p></div>
1550 <div class=
"olist arabic"><ol class=
"arabic">
1553 If
<tt>branch.
<name
>.merge
</tt> configuration for the current
1554 branch
<tt><name
></tt> exists, that is the name of the branch at the
1555 remote site that is merged.
1560 If the refspec is a globbing one, nothing is merged.
1565 Otherwise the remote branch of the first refspec is merged.
1570 <h2 id=
"_examples">EXAMPLES
</h2>
1571 <div class=
"sectionbody">
1572 <div class=
"ulist"><ul>
1575 Update the remote-tracking branches for the repository
1576 you cloned from, then merge one of them into your
1579 <div class=
"listingblock">
1580 <div class=
"content">
1581 <pre><tt>$ git pull, git pull origin
</tt></pre>
1583 <div class=
"paragraph"><p>Normally the branch merged in is the HEAD of the remote repository,
1584 but the choice is determined by the branch.
<name
>.remote and
1585 branch.
<name
>.merge options; see
<a href=
"git-config.html">git-config(
1)
</a> for details.
</p></div>
1589 Merge into the current branch the remote branch
<tt>next
</tt>:
1591 <div class=
"listingblock">
1592 <div class=
"content">
1593 <pre><tt>$ git pull origin next
</tt></pre>
1595 <div class=
"paragraph"><p>This leaves a copy of
<tt>next
</tt> temporarily in FETCH_HEAD, but
1596 does not update any remote-tracking branches. Using remote-tracking
1597 branches, the same can be done by invoking fetch and merge:
</p></div>
1598 <div class=
"listingblock">
1599 <div class=
"content">
1600 <pre><tt>$ git fetch origin
1601 $ git merge origin/next
</tt></pre>
1605 <div class=
"paragraph"><p>If you tried a pull which resulted in a complex conflicts and
1606 would want to start over, you can recover with
<em>git reset
</em>.
</p></div>
1608 <h2 id=
"_bugs">BUGS
</h2>
1609 <div class=
"sectionbody">
1610 <div class=
"paragraph"><p>Using --recurse-submodules can only fetch new commits in already checked
1611 out submodules right now. When e.g. upstream added a new submodule in the
1612 just fetched commits of the superproject the submodule itself can not be
1613 fetched, making it impossible to check out that submodule later without
1614 having to do a fetch again. This is expected to be fixed in a future git
1617 <h2 id=
"_see_also">SEE ALSO
</h2>
1618 <div class=
"sectionbody">
1619 <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>
1621 <h2 id=
"_git">GIT
</h2>
1622 <div class=
"sectionbody">
1623 <div class=
"paragraph"><p>Part of the
<a href=
"git.html">git(
1)
</a> suite
</p></div>
1626 <div id=
"footnotes"><hr /></div>
1628 <div id=
"footer-text">
1629 Last updated
2011-
09-
21 23:
01:
14 PDT