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.4.5" />
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.5em;
129 div
.content
{ /* Block element content. */
133 /* Block element titles. */
134 div
.title
, caption
.title
{
136 font-family: sans-serif
;
140 margin-bottom: 0.5em;
146 td div
.title:first-child
{
149 div
.content div
.title:first-child
{
152 div
.content
+ div
.title
{
156 div
.sidebarblock
> div
.content
{
158 border: 1px solid silver
;
162 div
.listingblock
> div
.content
{
163 border: 1px solid silver
;
172 div
.quoteblock
> div
.attribution
{
181 div
.verseblock
> div
.content
{
184 div
.verseblock
> div
.attribution
{
188 /* DEPRECATED: Pre version 8.2.7 verse style literal block. */
189 div
.verseblock
+ div
.attribution
{
193 div
.admonitionblock
.icon
{
197 text-decoration: underline
;
199 padding-right: 0.5em;
201 div
.admonitionblock td
.content
{
203 border-left: 2px solid silver
;
206 div
.exampleblock
> div
.content
{
207 border-left: 2px solid silver
;
211 div
.imageblock div
.content
{ padding-left: 0; }
212 span
.image img
{ border-style: none
; }
213 a
.image:visited
{ color: white
; }
217 margin-bottom: 0.8em;
230 list-style-position: outside
;
233 list-style-type: decimal
;
236 list-style-type: lower-alpha
;
239 list-style-type: upper-alpha
;
242 list-style-type: lower-roman
;
245 list-style-type: upper-roman
;
248 div
.compact ul
, div
.compact ol
,
249 div
.compact p
, div
.compact p
,
250 div
.compact div
, div
.compact div
{
252 margin-bottom: 0.1em;
255 div
.tableblock
> table
{
256 border: 3px solid
#527bbd;
259 font-family: sans-serif
;
271 /* Because the table frame attribute is overriden by CSS in most browsers. */
272 div
.tableblock
> table
[frame
="void"] {
275 div
.tableblock
> table
[frame
="hsides"] {
276 border-left-style: none
;
277 border-right-style: none
;
279 div
.tableblock
> table
[frame
="vsides"] {
280 border-top-style: none
;
281 border-bottom-style: none
;
287 margin-bottom: 0.8em;
290 padding-bottom: 15px;
292 dt
.hdlist1
.strong
, td
.hdlist1
.strong
{
298 padding-right: 0.8em;
304 div
.hdlist
.compact tr
{
314 div#footer-badges
{ display: none
; }
319 font-family: sans-serif
;
323 margin-bottom: 0.1em;
326 div
.toclevel1
, div
.toclevel2
, div
.toclevel3
, div
.toclevel4
{
342 /* Overrides for manpage documents */
345 padding-bottom: 0.5em;
346 border-top: 2px solid silver
;
347 border-bottom: 2px solid silver
;
357 div#toc
{ display: none
; }
360 /* Workarounds for IE6's broken and incomplete CSS2. */
362 div
.sidebar-content
{
364 border: 1px solid silver
;
367 div
.sidebar-title
, div
.image-title
{
369 font-family: sans-serif
;
372 margin-bottom: 0.5em;
375 div
.listingblock div
.content
{
376 border: 1px solid silver
;
381 div
.quoteblock-attribution
{
386 div
.verseblock-content
{
389 div
.verseblock-attribution
{
394 div
.exampleblock-content
{
395 border-left: 2px solid silver
;
399 /* IE6 sets dynamically generated links as visited. */
400 div#toc
a:visited
{ color: blue
; }
406 git-pull(
1) Manual Page
409 <div class=
"sectionbody">
411 Fetch from and merge with another repository or a local branch
415 <h2 id=
"_synopsis">SYNOPSIS
</h2>
416 <div class=
"sectionbody">
417 <div class=
"verseblock">
418 <div class=
"verseblock-content"><em>git pull
</em> [options] [
<repository
> [
<refspec
>…]]
</div>
419 <div class=
"verseblock-attribution">
422 <h2 id=
"_description">DESCRIPTION
</h2>
423 <div class=
"sectionbody">
424 <div class=
"paragraph"><p>Incorporates changes from a remote repository into the current
425 branch. In its default mode,
<tt>git pull
</tt> is shorthand for
426 <tt>git fetch
</tt> followed by
<tt>git merge FETCH_HEAD
</tt>.
</p></div>
427 <div class=
"paragraph"><p>More precisely,
<em>git pull
</em> runs
<em>git fetch
</em> with the given
428 parameters and calls
<em>git merge
</em> to merge the retrieved branch
429 heads into the current branch.
430 With
<tt>--rebase
</tt>, it runs
<em>git rebase
</em> instead of
<em>git merge
</em>.
</p></div>
431 <div class=
"paragraph"><p><repository
> should be the name of a remote repository as
432 passed to
<a href=
"git-fetch.html">git-fetch(
1)
</a>.
<refspec
> can name an
433 arbitrary remote ref (for example, the name of a tag) or even
434 a collection of refs with corresponding remote-tracking branches
435 (e.g., refs/heads/
*:refs/remotes/origin/
*),
436 but usually it is the name of a branch in the remote repository.
</p></div>
437 <div class=
"paragraph"><p>Default values for
<repository
> and
<branch
> are read from the
438 "remote" and
"merge" configuration for the current branch
439 as set by
<a href=
"git-branch.html">git-branch(
1)
</a> <tt>--track
</tt>.
</p></div>
440 <div class=
"paragraph"><p>Assume the following history exists and the current branch is
441 "<tt>master</tt>":
</p></div>
442 <div class=
"listingblock">
443 <div class=
"content">
444 <pre><tt> A---B---C master on origin
446 D---E---F---G master
</tt></pre>
448 <div class=
"paragraph"><p>Then
"<tt>git pull</tt>" will fetch and replay the changes from the remote
449 <tt>master
</tt> branch since it diverged from the local
<tt>master
</tt> (i.e.,
<tt>E
</tt>)
450 until its current commit (
<tt>C
</tt>) on top of
<tt>master
</tt> and record the
451 result in a new commit along with the names of the two parent commits
452 and a log message from the user describing the changes.
</p></div>
453 <div class=
"listingblock">
454 <div class=
"content">
455 <pre><tt> A---B---C remotes/origin/master
457 D---E---F---G---H master
</tt></pre>
459 <div class=
"paragraph"><p>See
<a href=
"git-merge.html">git-merge(
1)
</a> for details, including how conflicts
460 are presented and handled.
</p></div>
461 <div class=
"paragraph"><p>In git
1.7.0 or later, to cancel a conflicting merge, use
462 <tt>git reset --merge
</tt>.
<strong>Warning
</strong>: In older versions of git, running
<em>git pull
</em>
463 with uncommitted changes is discouraged: while possible, it leaves you
464 in a state that may be hard to back out of in the case of a conflict.
</p></div>
465 <div class=
"paragraph"><p>If any of the remote changes overlap with local uncommitted changes,
466 the merge will be automatically cancelled and the work tree untouched.
467 It is generally best to get any local changes in working order before
468 pulling or stash them away with
<a href=
"git-stash.html">git-stash(
1)
</a>.
</p></div>
470 <h2 id=
"_options">OPTIONS
</h2>
471 <div class=
"sectionbody">
472 <div class=
"paragraph"><p>Options meant for
<em>git pull
</em> itself and the underlying
<em>git merge
</em>
473 must be given before the options meant for
<em>git fetch
</em>.
</p></div>
474 <div class=
"dlist"><dl>
483 This is passed to both underlying git-fetch to squelch reporting of
484 during transfer, and underlying git-merge to squelch output during
496 Pass --verbose to git-fetch and git-merge.
500 --[no-]recurse-submodules[=yes|on-demand|no]
504 This option controls if new commits of all populated submodules should
505 be fetched too (see
<a href=
"git-config.html">git-config(
1)
</a> and
<a href=
"gitmodules.html">gitmodules(
5)
</a>).
506 That might be necessary to get the data needed for merging submodule
507 commits, a feature git learned in
1.7.3. Notice that the result of a
508 merge will not be checked out in the submodule,
"git submodule update"
509 has to be called afterwards to bring the work tree up to date with the
514 <h3 id=
"_options_related_to_merging">Options related to merging
</h3><div style=
"clear:left"></div>
515 <div class=
"dlist"><dl>
524 Perform the merge and commit the result. This option can
525 be used to override --no-commit.
527 <div class=
"paragraph"><p>With --no-commit perform the merge but pretend the merge
528 failed and do not autocommit, to give the user a chance to
529 inspect and further tweak the merge result before committing.
</p></div>
539 Do not generate a merge commit if the merge resolved as
540 a fast-forward, only update the branch pointer. This is
541 the default behavior of git-merge.
543 <div class=
"paragraph"><p>With --no-ff Generate a merge commit even if the merge
544 resolved as a fast-forward.
</p></div>
554 In addition to branch names, populate the log message with
555 one-line descriptions from at most
<n
> actual commits that are being
556 merged. See also
<a href=
"git-fmt-merge-msg.html">git-fmt-merge-msg(
1)
</a>.
558 <div class=
"paragraph"><p>With --no-log do not list one-line descriptions from the
559 actual commits being merged.
</p></div>
572 Show a diffstat at the end of the merge. The diffstat is also
573 controlled by the configuration option merge.stat.
575 <div class=
"paragraph"><p>With -n or --no-stat do not show a diffstat at the end of the
586 Produce the working tree and index state as if a real
587 merge happened (except for the merge information),
588 but do not actually make a commit or
589 move the
<tt>HEAD
</tt>, nor record
<tt>$GIT_DIR/MERGE_HEAD
</tt> to
590 cause the next
<tt>git commit
</tt> command to create a merge
591 commit. This allows you to create a single commit on
592 top of the current branch whose effect is the same as
593 merging another branch (or more in case of an octopus).
595 <div class=
"paragraph"><p>With --no-squash perform the merge and commit the result. This
596 option can be used to override --squash.
</p></div>
603 Refuse to merge and exit with a non-zero status unless the
604 current
<tt>HEAD
</tt> is already up-to-date or the merge can be
605 resolved as a fast-forward.
612 --strategy=
<strategy
>
616 Use the given merge strategy; can be supplied more than
617 once to specify them in the order they should be tried.
618 If there is no
<tt>-s
</tt> option, a built-in list of strategies
619 is used instead (
<em>git merge-recursive
</em> when merging a single
620 head,
<em>git merge-octopus
</em> otherwise).
627 --strategy-option=
<option
>
631 Pass merge strategy specific option through to the merge
643 Synonyms to --stat and --no-stat; these are deprecated and will be
644 removed in the future.
655 Operate quietly. Implies --no-progress.
677 Turn progress on/off explicitly. If neither is specified,
678 progress is shown if standard error is connected to a terminal.
679 Note that not all merge strategies may support progress
684 <div class=
"dlist"><dl>
690 Rebase the current branch on top of the upstream branch after
691 fetching. If there is a remote-tracking branch corresponding to
692 the upstream branch and the upstream branch was rebased since last
693 fetched, the rebase uses that information to avoid rebasing
696 <div class=
"paragraph"><p>See
<tt>branch.
<name
>.rebase
</tt> and
<tt>branch.autosetuprebase
</tt> in
697 <a href=
"git-config.html">git-config(
1)
</a> if you want to make
<tt>git pull
</tt> always use
698 <tt>--rebase
</tt> instead of merging.
</p></div>
699 <div class=
"admonitionblock">
702 <div class=
"title">Note
</div>
704 <td class=
"content">This is a potentially
<em>dangerous
</em> mode of operation.
705 It rewrites history, which does not bode well when you
706 published that history already. Do
<strong>not
</strong> use this option
707 unless you have read
<a href=
"git-rebase.html">git-rebase(
1)
</a> carefully.
</td>
716 Override earlier --rebase.
720 <h3 id=
"_options_related_to_fetching">Options related to fetching
</h3><div style=
"clear:left"></div>
721 <div class=
"dlist"><dl>
738 Append ref names and object names of fetched refs to the
739 existing contents of
<tt>.git/FETCH_HEAD
</tt>. Without this
740 option old data in
<tt>.git/FETCH_HEAD
</tt> will be overwritten.
744 --depth=
<depth
>
748 Deepen the history of a
<em>shallow
</em> repository created by
749 <tt>git clone
</tt> with
<tt>--depth=
<depth
></tt> option (see
<a href=
"git-clone.html">git-clone(
1)
</a>)
750 by the specified number of commits.
761 When
<em>git fetch
</em> is used with
<tt><rbranch
>:
<lbranch
></tt>
762 refspec, it refuses to update the local branch
763 <tt><lbranch
></tt> unless the remote branch
<tt><rbranch
></tt> it
764 fetches is a descendant of
<tt><lbranch
></tt>. This option
765 overrides that check.
776 Keep downloaded pack.
784 By default, tags that point at objects that are downloaded
785 from the remote repository are fetched and stored locally.
786 This option disables this automatic tag following. The default
787 behavior for a remote may be specified with the remote.
<name
>.tagopt
788 setting. See
<a href=
"git-config.html">git-config(
1)
</a>.
799 By default
<em>git fetch
</em> refuses to update the head which
800 corresponds to the current branch. This flag disables the
801 check. This is purely for the internal use for
<em>git pull
</em>
802 to communicate with
<em>git fetch
</em>, and unless you are
803 implementing your own Porcelain you are not supposed to
808 --upload-pack
<upload-pack
>
812 When given, and the repository to fetch from is handled
813 by
<em>git fetch-pack
</em>,
<em>--exec=
<upload-pack
></em> is passed to
814 the command to specify non-default path for the command
815 run on the other end.
823 Progress status is reported on the standard error stream
824 by default when it is attached to a terminal, unless -q
825 is specified. This flag forces progress status even if the
826 standard error stream is not directed to a terminal.
834 The
"remote" repository that is the source of a fetch
835 or pull operation. This parameter can be either a URL
836 (see the section
<a href=
"#URLS">GIT URLS
</a> below) or the name
837 of a remote (see the section
<a href=
"#REMOTES">REMOTES
</a> below).
845 The format of a
<refspec
> parameter is an optional plus
846 <tt>+</tt>, followed by the source ref
<src
>, followed
847 by a colon
<tt>:
</tt>, followed by the destination ref
<dst
>.
849 <div class=
"paragraph"><p>The remote ref that matches
<src
>
850 is fetched, and if
<dst
> is not empty string, the local
851 ref that matches it is fast-forwarded using
<src
>.
852 If the optional plus
<tt>+
</tt> is used, the local ref
853 is updated even if it does not result in a fast-forward
855 <div class=
"admonitionblock">
858 <div class=
"title">Note
</div>
860 <td class=
"content">If the remote branch from which you want to pull is
861 modified in non-linear ways such as being rewound and
862 rebased frequently, then a pull will attempt a merge with
863 an older version of itself, likely conflict, and fail.
864 It is under these conditions that you would want to use
865 the
<tt>+
</tt> sign to indicate non-fast-forward updates will
866 be needed. There is currently no easy way to determine
867 or declare that a branch will be made available in a
868 repository with this behavior; the pulling user simply
869 must know this is the expected usage pattern for a branch.
</td>
872 <div class=
"admonitionblock">
875 <div class=
"title">Note
</div>
877 <td class=
"content">You never do your own development on branches that appear
878 on the right hand side of a
<refspec
> colon on
<tt>Pull:
</tt> lines;
879 they are to be updated by
<em>git fetch
</em>. If you intend to do
880 development derived from a remote branch
<tt>B
</tt>, have a
<tt>Pull:
</tt>
881 line to track it (i.e.
<tt>Pull: B:remote-B
</tt>), and have a separate
882 branch
<tt>my-B
</tt> to do your development on top of it. The latter
883 is created by
<tt>git branch my-B remote-B
</tt> (or its equivalent
<tt>git
884 checkout -b my-B remote-B
</tt>). Run
<tt>git fetch
</tt> to keep track of
885 the progress of the remote side, and when you see something new
886 on the remote branch, merge it into your development branch with
887 <tt>git pull . remote-B
</tt>, while you are on
<tt>my-B
</tt> branch.
</td>
890 <div class=
"admonitionblock">
893 <div class=
"title">Note
</div>
895 <td class=
"content">There is a difference between listing multiple
<refspec
>
896 directly on
<em>git pull
</em> command line and having multiple
897 <tt>Pull:
</tt> <refspec
> lines for a
<repository
> and running
898 <em>git pull
</em> command without any explicit
<refspec
> parameters.
899 <refspec
> listed explicitly on the command line are always
900 merged into the current branch after fetching. In other words,
901 if you list more than one remote refs, you would be making
902 an Octopus. While
<em>git pull
</em> run without any explicit
<refspec
>
903 parameter takes default
<refspec
>s from
<tt>Pull:
</tt> lines, it
904 merges only the first
<refspec
> found into the current branch,
905 after fetching all the remote refs. This is because making an
906 Octopus from remote refs is rarely done, while keeping track
907 of multiple remote heads in one-go by fetching more than one
908 is often useful.
</td>
911 <div class=
"paragraph"><p>Some short-cut notations are also supported.
</p></div>
912 <div class=
"ulist"><ul>
915 <tt>tag
<tag
></tt> means the same as
<tt>refs/tags/
<tag
>:refs/tags/
<tag
></tt>;
916 it requests fetching everything up to the given tag.
921 A parameter
<ref
> without a colon is equivalent to
922 <ref
>: when pulling/fetching, so it merges
<ref
> into the current
923 branch without storing the remote branch anywhere locally
930 <h2 id=
"_git_urls_a_id_urls_a">GIT URLS
<a id=
"URLS"></a></h2>
931 <div class=
"sectionbody">
932 <div class=
"paragraph"><p>In general, URLs contain information about the transport protocol, the
933 address of the remote server, and the path to the repository.
934 Depending on the transport protocol, some of this information may be
936 <div class=
"paragraph"><p>Git natively supports ssh, git, http, https, ftp, ftps, and rsync
937 protocols. The following syntaxes may be used with them:
</p></div>
938 <div class=
"ulist"><ul>
941 ssh://
[user@
]host.xz
[:port
]/path/to/repo.git/
946 git://host.xz
[:port
]/path/to/repo.git/
951 http
[s
]://host.xz
[:port
]/path/to/repo.git/
956 ftp
[s
]://host.xz
[:port
]/path/to/repo.git/
961 rsync://host.xz/path/to/repo.git/
965 <div class=
"paragraph"><p>An alternative scp-like syntax may also be used with the ssh protocol:
</p></div>
966 <div class=
"ulist"><ul>
969 [user@
]host.xz:path/to/repo.git/
973 <div class=
"paragraph"><p>The ssh and git protocols additionally support ~username expansion:
</p></div>
974 <div class=
"ulist"><ul>
977 ssh://
[user@
]host.xz
[:port
]/~
[user
]/path/to/repo.git/
982 git://host.xz
[:port
]/~
[user
]/path/to/repo.git/
987 [user@
]host.xz:/~
[user
]/path/to/repo.git/
991 <div class=
"paragraph"><p>For local repositories, also supported by git natively, the following
992 syntaxes may be used:
</p></div>
993 <div class=
"ulist"><ul>
1001 <a href=
"file:///path/to/repo.git/">file:///path/to/repo.git/
</a>
1005 <div class=
"paragraph"><p>These two syntaxes are mostly equivalent, except when cloning, when
1006 the former implies --local option. See
<a href=
"git-clone.html">git-clone(
1)
</a> for
1008 <div class=
"paragraph"><p>When git doesn
’t know how to handle a certain transport protocol, it
1009 attempts to use the
<em>remote-
<transport
></em> remote helper, if one
1010 exists. To explicitly request a remote helper, the following syntax
1011 may be used:
</p></div>
1012 <div class=
"ulist"><ul>
1015 <transport
>::
<address
>
1019 <div class=
"paragraph"><p>where
<address
> may be a path, a server and path, or an arbitrary
1020 URL-like string recognized by the specific remote helper being
1021 invoked. See
<a href=
"git-remote-helpers.html">git-remote-helpers(
1)
</a> for details.
</p></div>
1022 <div class=
"paragraph"><p>If there are a large number of similarly-named remote repositories and
1023 you want to use a different format for them (such that the URLs you
1024 use will be rewritten into URLs that work), you can create a
1025 configuration section of the form:
</p></div>
1026 <div class=
"listingblock">
1027 <div class=
"content">
1028 <pre><tt> [url
"<actual url base>"]
1029 insteadOf =
<other url base
></tt></pre>
1031 <div class=
"paragraph"><p>For example, with this:
</p></div>
1032 <div class=
"listingblock">
1033 <div class=
"content">
1034 <pre><tt> [url
"git://git.host.xz/"]
1035 insteadOf = host.xz:/path/to/
1036 insteadOf = work:
</tt></pre>
1038 <div class=
"paragraph"><p>a URL like
"work:repo.git" or like
"host.xz:/path/to/repo.git" will be
1039 rewritten in any context that takes a URL to be
"git://git.host.xz/repo.git".
</p></div>
1040 <div class=
"paragraph"><p>If you want to rewrite URLs for push only, you can create a
1041 configuration section of the form:
</p></div>
1042 <div class=
"listingblock">
1043 <div class=
"content">
1044 <pre><tt> [url
"<actual url base>"]
1045 pushInsteadOf =
<other url base
></tt></pre>
1047 <div class=
"paragraph"><p>For example, with this:
</p></div>
1048 <div class=
"listingblock">
1049 <div class=
"content">
1050 <pre><tt> [url
"ssh://example.org/"]
1051 pushInsteadOf = git://example.org/
</tt></pre>
1053 <div class=
"paragraph"><p>a URL like
"git://example.org/path/to/repo.git" will be rewritten to
1054 "ssh://example.org/path/to/repo.git" for pushes, but pulls will still
1055 use the original URL.
</p></div>
1057 <h2 id=
"_remotes_a_id_remotes_a">REMOTES
<a id=
"REMOTES"></a></h2>
1058 <div class=
"sectionbody">
1059 <div class=
"paragraph"><p>The name of one of the following can be used instead
1060 of a URL as
<tt><repository
></tt> argument:
</p></div>
1061 <div class=
"ulist"><ul>
1064 a remote in the git configuration file:
<tt>$GIT_DIR/config
</tt>,
1069 a file in the
<tt>$GIT_DIR/remotes
</tt> directory, or
1074 a file in the
<tt>$GIT_DIR/branches
</tt> directory.
1078 <div class=
"paragraph"><p>All of these also allow you to omit the refspec from the command line
1079 because they each contain a refspec which git will use by default.
</p></div>
1080 <h3 id=
"_named_remote_in_configuration_file">Named remote in configuration file
</h3><div style=
"clear:left"></div>
1081 <div class=
"paragraph"><p>You can choose to provide the name of a remote which you had previously
1082 configured using
<a href=
"git-remote.html">git-remote(
1)
</a>,
<a href=
"git-config.html">git-config(
1)
</a>
1083 or even by a manual edit to the
<tt>$GIT_DIR/config
</tt> file. The URL of
1084 this remote will be used to access the repository. The refspec
1085 of this remote will be used by default when you do
1086 not provide a refspec on the command line. The entry in the
1087 config file would appear like this:
</p></div>
1088 <div class=
"listingblock">
1089 <div class=
"content">
1090 <pre><tt> [remote
"<name>"]
1092 pushurl =
<pushurl
>
1093 push =
<refspec
>
1094 fetch =
<refspec
></tt></pre>
1096 <div class=
"paragraph"><p>The
<tt><pushurl
></tt> is used for pushes only. It is optional and defaults
1097 to
<tt><url
></tt>.
</p></div>
1098 <h3 id=
"_named_file_in_tt_git_dir_remotes_tt">Named file in
<tt>$GIT_DIR/remotes
</tt></h3><div style=
"clear:left"></div>
1099 <div class=
"paragraph"><p>You can choose to provide the name of a
1100 file in
<tt>$GIT_DIR/remotes
</tt>. The URL
1101 in this file will be used to access the repository. The refspec
1102 in this file will be used as default when you do not
1103 provide a refspec on the command line. This file should have the
1104 following format:
</p></div>
1105 <div class=
"listingblock">
1106 <div class=
"content">
1107 <pre><tt> URL: one of the above URL format
1108 Push:
<refspec
>
1109 Pull:
<refspec
></tt></pre>
1111 <div class=
"paragraph"><p><tt>Push:
</tt> lines are used by
<em>git push
</em> and
1112 <tt>Pull:
</tt> lines are used by
<em>git pull
</em> and
<em>git fetch
</em>.
1113 Multiple
<tt>Push:
</tt> and
<tt>Pull:
</tt> lines may
1114 be specified for additional branch mappings.
</p></div>
1115 <h3 id=
"_named_file_in_tt_git_dir_branches_tt">Named file in
<tt>$GIT_DIR/branches
</tt></h3><div style=
"clear:left"></div>
1116 <div class=
"paragraph"><p>You can choose to provide the name of a
1117 file in
<tt>$GIT_DIR/branches
</tt>.
1118 The URL in this file will be used to access the repository.
1119 This file should have the following format:
</p></div>
1120 <div class=
"listingblock">
1121 <div class=
"content">
1122 <pre><tt> <url
>#
<head
></tt></pre>
1124 <div class=
"paragraph"><p><tt><url
></tt> is required;
<tt>#
<head
></tt> is optional.
</p></div>
1125 <div class=
"paragraph"><p>Depending on the operation, git will use one of the following
1126 refspecs, if you don
’t provide one on the command line.
1127 <tt><branch
></tt> is the name of this file in
<tt>$GIT_DIR/branches
</tt> and
1128 <tt><head
></tt> defaults to
<tt>master
</tt>.
</p></div>
1129 <div class=
"paragraph"><p>git fetch uses:
</p></div>
1130 <div class=
"listingblock">
1131 <div class=
"content">
1132 <pre><tt> refs/heads/
<head
>:refs/heads/
<branch
></tt></pre>
1134 <div class=
"paragraph"><p>git push uses:
</p></div>
1135 <div class=
"listingblock">
1136 <div class=
"content">
1137 <pre><tt> HEAD:refs/heads/
<head
></tt></pre>
1140 <h2 id=
"_merge_strategies">MERGE STRATEGIES
</h2>
1141 <div class=
"sectionbody">
1142 <div class=
"paragraph"><p>The merge mechanism (
<em>git-merge
</em> and
<em>git-pull
</em> commands) allows the
1143 backend
<em>merge strategies
</em> to be chosen with
<tt>-s
</tt> option. Some strategies
1144 can also take their own options, which can be passed by giving
<tt>-X
<option
></tt>
1145 arguments to
<em>git-merge
</em> and/or
<em>git-pull
</em>.
</p></div>
1146 <div class=
"dlist"><dl>
1147 <dt class=
"hdlist1">
1152 This can only resolve two heads (i.e. the current branch
1153 and another branch you pulled from) using a
3-way merge
1154 algorithm. It tries to carefully detect criss-cross
1155 merge ambiguities and is considered generally safe and
1159 <dt class=
"hdlist1">
1164 This can only resolve two heads using a
3-way merge
1165 algorithm. When there is more than one common
1166 ancestor that can be used for
3-way merge, it creates a
1167 merged tree of the common ancestors and uses that as
1168 the reference tree for the
3-way merge. This has been
1169 reported to result in fewer merge conflicts without
1170 causing mis-merges by tests done on actual merge commits
1171 taken from Linux
2.6 kernel development history.
1172 Additionally this can detect and handle merges involving
1173 renames. This is the default merge strategy when
1174 pulling or merging one branch.
1176 <div class=
"paragraph"><p>The
<em>recursive
</em> strategy can take the following options:
</p></div>
1177 <div class=
"dlist"><dl>
1178 <dt class=
"hdlist1">
1183 This option forces conflicting hunks to be auto-resolved cleanly by
1184 favoring
<em>our
</em> version. Changes from the other tree that do not
1185 conflict with our side are reflected to the merge result.
1187 <div class=
"paragraph"><p>This should not be confused with the
<em>ours
</em> merge strategy, which does not
1188 even look at what the other tree contains at all. It discards everything
1189 the other tree did, declaring
<em>our
</em> history contains all that happened in it.
</p></div>
1191 <dt class=
"hdlist1">
1196 This is opposite of
<em>ours
</em>.
1199 <dt class=
"hdlist1">
1204 With this option,
<em>merge-recursive
</em> spends a little extra time
1205 to avoid mismerges that sometimes occur due to unimportant
1206 matching lines (e.g., braces from distinct functions). Use
1207 this when the branches to be merged have diverged wildly.
1208 See also
<a href=
"git-diff.html">git-diff(
1)
</a> <tt>--patience
</tt>.
1211 <dt class=
"hdlist1">
1214 <dt class=
"hdlist1">
1217 <dt class=
"hdlist1">
1222 Treats lines with the indicated type of whitespace change as
1223 unchanged for the sake of a three-way merge. Whitespace
1224 changes mixed with other changes to a line are not ignored.
1225 See also
<a href=
"git-diff.html">git-diff(
1)
</a> <tt>-b
</tt>,
<tt>-w
</tt>, and
1226 <tt>--ignore-space-at-eol
</tt>.
1228 <div class=
"ulist"><ul>
1231 If
<em>their
</em> version only introduces whitespace changes to a line,
1232 <em>our
</em> version is used;
1237 If
<em>our
</em> version introduces whitespace changes but
<em>their
</em>
1238 version includes a substantial change,
<em>their
</em> version is used;
1243 Otherwise, the merge proceeds in the usual way.
1248 <dt class=
"hdlist1">
1253 This runs a virtual check-out and check-in of all three stages
1254 of a file when resolving a three-way merge. This option is
1255 meant to be used when merging branches with different clean
1256 filters or end-of-line normalization rules. See
"Merging
1257 branches with differing checkin/checkout attributes" in
1258 <a href=
"gitattributes.html">gitattributes(
5)
</a> for details.
1261 <dt class=
"hdlist1">
1266 Disables the
<tt>renormalize
</tt> option. This overrides the
1267 <tt>merge.renormalize
</tt> configuration variable.
1270 <dt class=
"hdlist1">
1271 rename-threshold=
<n
>
1275 Controls the similarity threshold used for rename detection.
1276 See also
<a href=
"git-diff.html">git-diff(
1)
</a> <tt>-M
</tt>.
1279 <dt class=
"hdlist1">
1280 subtree[=
<path
>]
1284 This option is a more advanced form of
<em>subtree
</em> strategy, where
1285 the strategy makes a guess on how two trees must be shifted to
1286 match with each other when merging. Instead, the specified path
1287 is prefixed (or stripped from the beginning) to make the shape of
1293 <dt class=
"hdlist1">
1298 This resolves cases with more than two heads, but refuses to do
1299 a complex merge that needs manual resolution. It is
1300 primarily meant to be used for bundling topic branch
1301 heads together. This is the default merge strategy when
1302 pulling or merging more than one branch.
1305 <dt class=
"hdlist1">
1310 This resolves any number of heads, but the resulting tree of the
1311 merge is always that of the current branch head, effectively
1312 ignoring all changes from all other branches. It is meant to
1313 be used to supersede old development history of side
1314 branches. Note that this is different from the -Xours option to
1315 the
<em>recursive
</em> merge strategy.
1318 <dt class=
"hdlist1">
1323 This is a modified recursive strategy. When merging trees A and
1324 B, if B corresponds to a subtree of A, B is first adjusted to
1325 match the tree structure of A, instead of reading the trees at
1326 the same level. This adjustment is also done to the common
1332 <h2 id=
"_default_behaviour">DEFAULT BEHAVIOUR
</h2>
1333 <div class=
"sectionbody">
1334 <div class=
"paragraph"><p>Often people use
<tt>git pull
</tt> without giving any parameter.
1335 Traditionally, this has been equivalent to saying
<tt>git pull
1336 origin
</tt>. However, when configuration
<tt>branch.
<name
>.remote
</tt> is
1337 present while on branch
<tt><name
></tt>, that value is used instead of
1338 <tt>origin
</tt>.
</p></div>
1339 <div class=
"paragraph"><p>In order to determine what URL to use to fetch from, the value
1340 of the configuration
<tt>remote.
<origin
>.url
</tt> is consulted
1341 and if there is not any such variable, the value on
<tt>URL: ` line
1342 in `$GIT_DIR/remotes/
<origin
></tt> file is used.
</p></div>
1343 <div class=
"paragraph"><p>In order to determine what remote branches to fetch (and
1344 optionally store in the remote-tracking branches) when the command is
1345 run without any refspec parameters on the command line, values
1346 of the configuration variable
<tt>remote.
<origin
>.fetch
</tt> are
1347 consulted, and if there aren
’t any,
<tt>$GIT_DIR/remotes/
<origin
></tt>
1348 file is consulted and its `Pull: ` lines are used.
1349 In addition to the refspec formats described in the OPTIONS
1350 section, you can have a globbing refspec that looks like this:
</p></div>
1351 <div class=
"listingblock">
1352 <div class=
"content">
1353 <pre><tt>refs/heads/*:refs/remotes/origin/*
</tt></pre>
1355 <div class=
"paragraph"><p>A globbing refspec must have a non-empty RHS (i.e. must store
1356 what were fetched in remote-tracking branches), and its LHS and RHS
1357 must end with
<tt>/*
</tt>. The above specifies that all remote
1358 branches are tracked using remote-tracking branches in
1359 <tt>refs/remotes/origin/
</tt> hierarchy under the same name.
</p></div>
1360 <div class=
"paragraph"><p>The rule to determine which remote branch to merge after
1361 fetching is a bit involved, in order not to break backward
1362 compatibility.
</p></div>
1363 <div class=
"paragraph"><p>If explicit refspecs were given on the command
1364 line of
<tt>git pull
</tt>, they are all merged.
</p></div>
1365 <div class=
"paragraph"><p>When no refspec was given on the command line, then
<tt>git pull
</tt>
1366 uses the refspec from the configuration or
1367 <tt>$GIT_DIR/remotes/
<origin
></tt>. In such cases, the following
1368 rules apply:
</p></div>
1369 <div class=
"olist arabic"><ol class=
"arabic">
1372 If
<tt>branch.
<name
>.merge
</tt> configuration for the current
1373 branch
<tt><name
></tt> exists, that is the name of the branch at the
1374 remote site that is merged.
1379 If the refspec is a globbing one, nothing is merged.
1384 Otherwise the remote branch of the first refspec is merged.
1389 <h2 id=
"_examples">EXAMPLES
</h2>
1390 <div class=
"sectionbody">
1391 <div class=
"ulist"><ul>
1394 Update the remote-tracking branches for the repository
1395 you cloned from, then merge one of them into your
1398 <div class=
"listingblock">
1399 <div class=
"content">
1400 <pre><tt>$ git pull, git pull origin
</tt></pre>
1402 <div class=
"paragraph"><p>Normally the branch merged in is the HEAD of the remote repository,
1403 but the choice is determined by the branch.
<name
>.remote and
1404 branch.
<name
>.merge options; see
<a href=
"git-config.html">git-config(
1)
</a> for details.
</p></div>
1408 Merge into the current branch the remote branch
<tt>next
</tt>:
1410 <div class=
"listingblock">
1411 <div class=
"content">
1412 <pre><tt>$ git pull origin next
</tt></pre>
1414 <div class=
"paragraph"><p>This leaves a copy of
<tt>next
</tt> temporarily in FETCH_HEAD, but
1415 does not update any remote-tracking branches. Using remote-tracking
1416 branches, the same can be done by invoking fetch and merge:
</p></div>
1417 <div class=
"listingblock">
1418 <div class=
"content">
1419 <pre><tt>$ git fetch origin
1420 $ git merge origin/next
</tt></pre>
1424 <div class=
"paragraph"><p>If you tried a pull which resulted in a complex conflicts and
1425 would want to start over, you can recover with
<em>git reset
</em>.
</p></div>
1427 <h2 id=
"_bugs">BUGS
</h2>
1428 <div class=
"sectionbody">
1429 <div class=
"paragraph"><p>Using --recurse-submodules can only fetch new commits in already checked
1430 out submodules right now. When e.g. upstream added a new submodule in the
1431 just fetched commits of the superproject the submodule itself can not be
1432 fetched, making it impossible to check out that submodule later without
1433 having to do a fetch again. This is expected to be fixed in a future git
1436 <h2 id=
"_see_also">SEE ALSO
</h2>
1437 <div class=
"sectionbody">
1438 <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>
1440 <h2 id=
"_git">GIT
</h2>
1441 <div class=
"sectionbody">
1442 <div class=
"paragraph"><p>Part of the
<a href=
"git.html">git(
1)
</a> suite
</p></div>
1445 <div id=
"footer-text">
1446 Last updated
2011-
07-
23 00:
49:
30 UTC