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=
"paragraph"><p><em>git pull
</em> [options] [
<repository
> [
<refspec
>…]]
</p></div>
419 <h2 id=
"_description">DESCRIPTION
</h2>
420 <div class=
"sectionbody">
421 <div class=
"paragraph"><p>Incorporates changes from a remote repository into the current
422 branch. In its default mode,
<tt>git pull
</tt> is shorthand for
423 <tt>git fetch
</tt> followed by
<tt>git merge FETCH_HEAD
</tt>.
</p></div>
424 <div class=
"paragraph"><p>More precisely,
<em>git pull
</em> runs
<em>git fetch
</em> with the given
425 parameters and calls
<em>git merge
</em> to merge the retrieved branch
426 heads into the current branch.
427 With
<tt>--rebase
</tt>, it runs
<em>git rebase
</em> instead of
<em>git merge
</em>.
</p></div>
428 <div class=
"paragraph"><p><repository
> should be the name of a remote repository as
429 passed to
<a href=
"git-fetch.html">git-fetch(
1)
</a>.
<refspec
> can name an
430 arbitrary remote ref (for example, the name of a tag) or even
431 a collection of refs with corresponding remote-tracking branches
432 (e.g., refs/heads/
*:refs/remotes/origin/
*),
433 but usually it is the name of a branch in the remote repository.
</p></div>
434 <div class=
"paragraph"><p>Default values for
<repository
> and
<branch
> are read from the
435 "remote" and
"merge" configuration for the current branch
436 as set by
<a href=
"git-branch.html">git-branch(
1)
</a> <tt>--track
</tt>.
</p></div>
437 <div class=
"paragraph"><p>Assume the following history exists and the current branch is
438 "<tt>master</tt>":
</p></div>
439 <div class=
"listingblock">
440 <div class=
"content">
441 <pre><tt> A---B---C master on origin
443 D---E---F---G master
</tt></pre>
445 <div class=
"paragraph"><p>Then
"<tt>git pull</tt>" will fetch and replay the changes from the remote
446 <tt>master
</tt> branch since it diverged from the local
<tt>master
</tt> (i.e.,
<tt>E
</tt>)
447 until its current commit (
<tt>C
</tt>) on top of
<tt>master
</tt> and record the
448 result in a new commit along with the names of the two parent commits
449 and a log message from the user describing the changes.
</p></div>
450 <div class=
"listingblock">
451 <div class=
"content">
452 <pre><tt> A---B---C remotes/origin/master
454 D---E---F---G---H master
</tt></pre>
456 <div class=
"paragraph"><p>See
<a href=
"git-merge.html">git-merge(
1)
</a> for details, including how conflicts
457 are presented and handled.
</p></div>
458 <div class=
"paragraph"><p>In git
1.7.0 or later, to cancel a conflicting merge, use
459 <tt>git reset --merge
</tt>.
<strong>Warning
</strong>: In older versions of git, running
<em>git pull
</em>
460 with uncommitted changes is discouraged: while possible, it leaves you
461 in a state that may be hard to back out of in the case of a conflict.
</p></div>
462 <div class=
"paragraph"><p>If any of the remote changes overlap with local uncommitted changes,
463 the merge will be automatically cancelled and the work tree untouched.
464 It is generally best to get any local changes in working order before
465 pulling or stash them away with
<a href=
"git-stash.html">git-stash(
1)
</a>.
</p></div>
467 <h2 id=
"_options">OPTIONS
</h2>
468 <div class=
"sectionbody">
469 <div class=
"paragraph"><p>Options meant for
<em>git pull
</em> itself and the underlying
<em>git merge
</em>
470 must be given before the options meant for
<em>git fetch
</em>.
</p></div>
471 <div class=
"dlist"><dl>
480 This is passed to both underlying git-fetch to squelch reporting of
481 during transfer, and underlying git-merge to squelch output during
493 Pass --verbose to git-fetch and git-merge.
497 --[no-]recurse-submodules
501 This option controls if new commits of all populated submodules should
502 be fetched too (see
<a href=
"git-config.html">git-config(
1)
</a> and
<a href=
"gitmodules.html">gitmodules(
5)
</a>).
503 That might be necessary to get the data needed for merging submodule
504 commits, a feature git learned in
1.7.3. Notice that the result of a
505 merge will not be checked out in the submodule,
"git submodule update"
506 has to be called afterwards to bring the work tree up to date with the
511 <h3 id=
"_options_related_to_merging">Options related to merging
</h3><div style=
"clear:left"></div>
512 <div class=
"dlist"><dl>
521 Perform the merge and commit the result. This option can
522 be used to override --no-commit.
524 <div class=
"paragraph"><p>With --no-commit perform the merge but pretend the merge
525 failed and do not autocommit, to give the user a chance to
526 inspect and further tweak the merge result before committing.
</p></div>
536 Do not generate a merge commit if the merge resolved as
537 a fast-forward, only update the branch pointer. This is
538 the default behavior of git-merge.
540 <div class=
"paragraph"><p>With --no-ff Generate a merge commit even if the merge
541 resolved as a fast-forward.
</p></div>
551 In addition to branch names, populate the log message with
552 one-line descriptions from at most
<n
> actual commits that are being
553 merged. See also
<a href=
"git-fmt-merge-msg.html">git-fmt-merge-msg(
1)
</a>.
555 <div class=
"paragraph"><p>With --no-log do not list one-line descriptions from the
556 actual commits being merged.
</p></div>
569 Show a diffstat at the end of the merge. The diffstat is also
570 controlled by the configuration option merge.stat.
572 <div class=
"paragraph"><p>With -n or --no-stat do not show a diffstat at the end of the
583 Produce the working tree and index state as if a real
584 merge happened (except for the merge information),
585 but do not actually make a commit or
586 move the
<tt>HEAD
</tt>, nor record
<tt>$GIT_DIR/MERGE_HEAD
</tt> to
587 cause the next
<tt>git commit
</tt> command to create a merge
588 commit. This allows you to create a single commit on
589 top of the current branch whose effect is the same as
590 merging another branch (or more in case of an octopus).
592 <div class=
"paragraph"><p>With --no-squash perform the merge and commit the result. This
593 option can be used to override --squash.
</p></div>
600 Refuse to merge and exit with a non-zero status unless the
601 current
<tt>HEAD
</tt> is already up-to-date or the merge can be
602 resolved as a fast-forward.
609 --strategy=
<strategy
>
613 Use the given merge strategy; can be supplied more than
614 once to specify them in the order they should be tried.
615 If there is no
<tt>-s
</tt> option, a built-in list of strategies
616 is used instead (
<em>git merge-recursive
</em> when merging a single
617 head,
<em>git merge-octopus
</em> otherwise).
624 --strategy-option=
<option
>
628 Pass merge strategy specific option through to the merge
640 Synonyms to --stat and --no-stat; these are deprecated and will be
641 removed in the future.
667 <div class=
"dlist"><dl>
673 Rebase the current branch on top of the upstream branch after
674 fetching. If there is a remote-tracking branch corresponding to
675 the upstream branch and the upstream branch was rebased since last
676 fetched, the rebase uses that information to avoid rebasing
679 <div class=
"paragraph"><p>See
<tt>branch.
<name
>.rebase
</tt> and
<tt>branch.autosetuprebase
</tt> in
680 <a href=
"git-config.html">git-config(
1)
</a> if you want to make
<tt>git pull
</tt> always use
681 <tt>--rebase
</tt> instead of merging.
</p></div>
682 <div class=
"admonitionblock">
685 <div class=
"title">Note
</div>
687 <td class=
"content">This is a potentially
<em>dangerous
</em> mode of operation.
688 It rewrites history, which does not bode well when you
689 published that history already. Do
<strong>not
</strong> use this option
690 unless you have read
<a href=
"git-rebase.html">git-rebase(
1)
</a> carefully.
</td>
699 Override earlier --rebase.
703 <h3 id=
"_options_related_to_fetching">Options related to fetching
</h3><div style=
"clear:left"></div>
704 <div class=
"dlist"><dl>
721 Append ref names and object names of fetched refs to the
722 existing contents of
<tt>.git/FETCH_HEAD
</tt>. Without this
723 option old data in
<tt>.git/FETCH_HEAD
</tt> will be overwritten.
727 --depth=
<depth
>
731 Deepen the history of a
<em>shallow
</em> repository created by
732 <tt>git clone
</tt> with
<tt>--depth=
<depth
></tt> option (see
<a href=
"git-clone.html">git-clone(
1)
</a>)
733 by the specified number of commits.
744 When
<em>git fetch
</em> is used with
<tt><rbranch
>:
<lbranch
></tt>
745 refspec, it refuses to update the local branch
746 <tt><lbranch
></tt> unless the remote branch
<tt><rbranch
></tt> it
747 fetches is a descendant of
<tt><lbranch
></tt>. This option
748 overrides that check.
759 Keep downloaded pack.
767 By default, tags that point at objects that are downloaded
768 from the remote repository are fetched and stored locally.
769 This option disables this automatic tag following. The default
770 behavior for a remote may be specified with the remote.
<name
>.tagopt
771 setting. See
<a href=
"git-config.html">git-config(
1)
</a>.
782 By default
<em>git fetch
</em> refuses to update the head which
783 corresponds to the current branch. This flag disables the
784 check. This is purely for the internal use for
<em>git pull
</em>
785 to communicate with
<em>git fetch
</em>, and unless you are
786 implementing your own Porcelain you are not supposed to
791 --upload-pack
<upload-pack
>
795 When given, and the repository to fetch from is handled
796 by
<em>git fetch-pack
</em>,
<em>--exec=
<upload-pack
></em> is passed to
797 the command to specify non-default path for the command
798 run on the other end.
806 Progress status is reported on the standard error stream
807 by default when it is attached to a terminal, unless -q
808 is specified. This flag forces progress status even if the
809 standard error stream is not directed to a terminal.
817 The
"remote" repository that is the source of a fetch
818 or pull operation. This parameter can be either a URL
819 (see the section
<a href=
"#URLS">GIT URLS
</a> below) or the name
820 of a remote (see the section
<a href=
"#REMOTES">REMOTES
</a> below).
828 The format of a
<refspec
> parameter is an optional plus
829 <tt>+</tt>, followed by the source ref
<src
>, followed
830 by a colon
<tt>:
</tt>, followed by the destination ref
<dst
>.
832 <div class=
"paragraph"><p>The remote ref that matches
<src
>
833 is fetched, and if
<dst
> is not empty string, the local
834 ref that matches it is fast-forwarded using
<src
>.
835 If the optional plus
<tt>+
</tt> is used, the local ref
836 is updated even if it does not result in a fast-forward
838 <div class=
"admonitionblock">
841 <div class=
"title">Note
</div>
843 <td class=
"content">If the remote branch from which you want to pull is
844 modified in non-linear ways such as being rewound and
845 rebased frequently, then a pull will attempt a merge with
846 an older version of itself, likely conflict, and fail.
847 It is under these conditions that you would want to use
848 the
<tt>+
</tt> sign to indicate non-fast-forward updates will
849 be needed. There is currently no easy way to determine
850 or declare that a branch will be made available in a
851 repository with this behavior; the pulling user simply
852 must know this is the expected usage pattern for a branch.
</td>
855 <div class=
"admonitionblock">
858 <div class=
"title">Note
</div>
860 <td class=
"content">You never do your own development on branches that appear
861 on the right hand side of a
<refspec
> colon on
<tt>Pull:
</tt> lines;
862 they are to be updated by
<em>git fetch
</em>. If you intend to do
863 development derived from a remote branch
<tt>B
</tt>, have a
<tt>Pull:
</tt>
864 line to track it (i.e.
<tt>Pull: B:remote-B
</tt>), and have a separate
865 branch
<tt>my-B
</tt> to do your development on top of it. The latter
866 is created by
<tt>git branch my-B remote-B
</tt> (or its equivalent
<tt>git
867 checkout -b my-B remote-B
</tt>). Run
<tt>git fetch
</tt> to keep track of
868 the progress of the remote side, and when you see something new
869 on the remote branch, merge it into your development branch with
870 <tt>git pull . remote-B
</tt>, while you are on
<tt>my-B
</tt> branch.
</td>
873 <div class=
"admonitionblock">
876 <div class=
"title">Note
</div>
878 <td class=
"content">There is a difference between listing multiple
<refspec
>
879 directly on
<em>git pull
</em> command line and having multiple
880 <tt>Pull:
</tt> <refspec
> lines for a
<repository
> and running
881 <em>git pull
</em> command without any explicit
<refspec
> parameters.
882 <refspec
> listed explicitly on the command line are always
883 merged into the current branch after fetching. In other words,
884 if you list more than one remote refs, you would be making
885 an Octopus. While
<em>git pull
</em> run without any explicit
<refspec
>
886 parameter takes default
<refspec
>s from
<tt>Pull:
</tt> lines, it
887 merges only the first
<refspec
> found into the current branch,
888 after fetching all the remote refs. This is because making an
889 Octopus from remote refs is rarely done, while keeping track
890 of multiple remote heads in one-go by fetching more than one
891 is often useful.
</td>
894 <div class=
"paragraph"><p>Some short-cut notations are also supported.
</p></div>
895 <div class=
"ulist"><ul>
898 <tt>tag
<tag
></tt> means the same as
<tt>refs/tags/
<tag
>:refs/tags/
<tag
></tt>;
899 it requests fetching everything up to the given tag.
904 A parameter
<ref
> without a colon is equivalent to
905 <ref
>: when pulling/fetching, so it merges
<ref
> into the current
906 branch without storing the remote branch anywhere locally
913 <h2 id=
"_git_urls_a_id_urls_a">GIT URLS
<a id=
"URLS"></a></h2>
914 <div class=
"sectionbody">
915 <div class=
"paragraph"><p>In general, URLs contain information about the transport protocol, the
916 address of the remote server, and the path to the repository.
917 Depending on the transport protocol, some of this information may be
919 <div class=
"paragraph"><p>Git natively supports ssh, git, http, https, ftp, ftps, and rsync
920 protocols. The following syntaxes may be used with them:
</p></div>
921 <div class=
"ulist"><ul>
924 ssh://
[user@
]host.xz
[:port
]/path/to/repo.git/
929 git://host.xz
[:port
]/path/to/repo.git/
934 http
[s
]://host.xz
[:port
]/path/to/repo.git/
939 ftp
[s
]://host.xz
[:port
]/path/to/repo.git/
944 rsync://host.xz/path/to/repo.git/
948 <div class=
"paragraph"><p>An alternative scp-like syntax may also be used with the ssh protocol:
</p></div>
949 <div class=
"ulist"><ul>
952 [user@
]host.xz:path/to/repo.git/
956 <div class=
"paragraph"><p>The ssh and git protocols additionally support ~username expansion:
</p></div>
957 <div class=
"ulist"><ul>
960 ssh://
[user@
]host.xz
[:port
]/~
[user
]/path/to/repo.git/
965 git://host.xz
[:port
]/~
[user
]/path/to/repo.git/
970 [user@
]host.xz:/~
[user
]/path/to/repo.git/
974 <div class=
"paragraph"><p>For local repositories, also supported by git natively, the following
975 syntaxes may be used:
</p></div>
976 <div class=
"ulist"><ul>
984 <a href=
"file:///path/to/repo.git/">file:///path/to/repo.git/
</a>
988 <div class=
"paragraph"><p>These two syntaxes are mostly equivalent, except when cloning, when
989 the former implies --local option. See
<a href=
"git-clone.html">git-clone(
1)
</a> for
991 <div class=
"paragraph"><p>When git doesn
’t know how to handle a certain transport protocol, it
992 attempts to use the
<em>remote-
<transport
></em> remote helper, if one
993 exists. To explicitly request a remote helper, the following syntax
994 may be used:
</p></div>
995 <div class=
"ulist"><ul>
998 <transport
>::
<address
>
1002 <div class=
"paragraph"><p>where
<address
> may be a path, a server and path, or an arbitrary
1003 URL-like string recognized by the specific remote helper being
1004 invoked. See
<a href=
"git-remote-helpers.html">git-remote-helpers(
1)
</a> for details.
</p></div>
1005 <div class=
"paragraph"><p>If there are a large number of similarly-named remote repositories and
1006 you want to use a different format for them (such that the URLs you
1007 use will be rewritten into URLs that work), you can create a
1008 configuration section of the form:
</p></div>
1009 <div class=
"listingblock">
1010 <div class=
"content">
1011 <pre><tt> [url
"<actual url base>"]
1012 insteadOf =
<other url base
></tt></pre>
1014 <div class=
"paragraph"><p>For example, with this:
</p></div>
1015 <div class=
"listingblock">
1016 <div class=
"content">
1017 <pre><tt> [url
"git://git.host.xz/"]
1018 insteadOf = host.xz:/path/to/
1019 insteadOf = work:
</tt></pre>
1021 <div class=
"paragraph"><p>a URL like
"work:repo.git" or like
"host.xz:/path/to/repo.git" will be
1022 rewritten in any context that takes a URL to be
"git://git.host.xz/repo.git".
</p></div>
1023 <div class=
"paragraph"><p>If you want to rewrite URLs for push only, you can create a
1024 configuration section of the form:
</p></div>
1025 <div class=
"listingblock">
1026 <div class=
"content">
1027 <pre><tt> [url
"<actual url base>"]
1028 pushInsteadOf =
<other url base
></tt></pre>
1030 <div class=
"paragraph"><p>For example, with this:
</p></div>
1031 <div class=
"listingblock">
1032 <div class=
"content">
1033 <pre><tt> [url
"ssh://example.org/"]
1034 pushInsteadOf = git://example.org/
</tt></pre>
1036 <div class=
"paragraph"><p>a URL like
"git://example.org/path/to/repo.git" will be rewritten to
1037 "ssh://example.org/path/to/repo.git" for pushes, but pulls will still
1038 use the original URL.
</p></div>
1040 <h2 id=
"_remotes_a_id_remotes_a">REMOTES
<a id=
"REMOTES"></a></h2>
1041 <div class=
"sectionbody">
1042 <div class=
"paragraph"><p>The name of one of the following can be used instead
1043 of a URL as
<tt><repository
></tt> argument:
</p></div>
1044 <div class=
"ulist"><ul>
1047 a remote in the git configuration file:
<tt>$GIT_DIR/config
</tt>,
1052 a file in the
<tt>$GIT_DIR/remotes
</tt> directory, or
1057 a file in the
<tt>$GIT_DIR/branches
</tt> directory.
1061 <div class=
"paragraph"><p>All of these also allow you to omit the refspec from the command line
1062 because they each contain a refspec which git will use by default.
</p></div>
1063 <h3 id=
"_named_remote_in_configuration_file">Named remote in configuration file
</h3><div style=
"clear:left"></div>
1064 <div class=
"paragraph"><p>You can choose to provide the name of a remote which you had previously
1065 configured using
<a href=
"git-remote.html">git-remote(
1)
</a>,
<a href=
"git-config.html">git-config(
1)
</a>
1066 or even by a manual edit to the
<tt>$GIT_DIR/config
</tt> file. The URL of
1067 this remote will be used to access the repository. The refspec
1068 of this remote will be used by default when you do
1069 not provide a refspec on the command line. The entry in the
1070 config file would appear like this:
</p></div>
1071 <div class=
"listingblock">
1072 <div class=
"content">
1073 <pre><tt> [remote
"<name>"]
1075 pushurl =
<pushurl
>
1076 push =
<refspec
>
1077 fetch =
<refspec
></tt></pre>
1079 <div class=
"paragraph"><p>The
<tt><pushurl
></tt> is used for pushes only. It is optional and defaults
1080 to
<tt><url
></tt>.
</p></div>
1081 <h3 id=
"_named_file_in_tt_git_dir_remotes_tt">Named file in
<tt>$GIT_DIR/remotes
</tt></h3><div style=
"clear:left"></div>
1082 <div class=
"paragraph"><p>You can choose to provide the name of a
1083 file in
<tt>$GIT_DIR/remotes
</tt>. The URL
1084 in this file will be used to access the repository. The refspec
1085 in this file will be used as default when you do not
1086 provide a refspec on the command line. This file should have the
1087 following format:
</p></div>
1088 <div class=
"listingblock">
1089 <div class=
"content">
1090 <pre><tt> URL: one of the above URL format
1091 Push:
<refspec
>
1092 Pull:
<refspec
></tt></pre>
1094 <div class=
"paragraph"><p><tt>Push:
</tt> lines are used by
<em>git push
</em> and
1095 <tt>Pull:
</tt> lines are used by
<em>git pull
</em> and
<em>git fetch
</em>.
1096 Multiple
<tt>Push:
</tt> and
<tt>Pull:
</tt> lines may
1097 be specified for additional branch mappings.
</p></div>
1098 <h3 id=
"_named_file_in_tt_git_dir_branches_tt">Named file in
<tt>$GIT_DIR/branches
</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/branches
</tt>.
1101 The URL in this file will be used to access the repository.
1102 This file should have the following format:
</p></div>
1103 <div class=
"listingblock">
1104 <div class=
"content">
1105 <pre><tt> <url
>#
<head
></tt></pre>
1107 <div class=
"paragraph"><p><tt><url
></tt> is required;
<tt>#
<head
></tt> is optional.
</p></div>
1108 <div class=
"paragraph"><p>Depending on the operation, git will use one of the following
1109 refspecs, if you don
’t provide one on the command line.
1110 <tt><branch
></tt> is the name of this file in
<tt>$GIT_DIR/branches
</tt> and
1111 <tt><head
></tt> defaults to
<tt>master
</tt>.
</p></div>
1112 <div class=
"paragraph"><p>git fetch uses:
</p></div>
1113 <div class=
"listingblock">
1114 <div class=
"content">
1115 <pre><tt> refs/heads/
<head
>:refs/heads/
<branch
></tt></pre>
1117 <div class=
"paragraph"><p>git push uses:
</p></div>
1118 <div class=
"listingblock">
1119 <div class=
"content">
1120 <pre><tt> HEAD:refs/heads/
<head
></tt></pre>
1123 <h2 id=
"_merge_strategies">MERGE STRATEGIES
</h2>
1124 <div class=
"sectionbody">
1125 <div class=
"paragraph"><p>The merge mechanism (
<em>git-merge
</em> and
<em>git-pull
</em> commands) allows the
1126 backend
<em>merge strategies
</em> to be chosen with
<tt>-s
</tt> option. Some strategies
1127 can also take their own options, which can be passed by giving
<tt>-X
<option
></tt>
1128 arguments to
<em>git-merge
</em> and/or
<em>git-pull
</em>.
</p></div>
1129 <div class=
"dlist"><dl>
1130 <dt class=
"hdlist1">
1135 This can only resolve two heads (i.e. the current branch
1136 and another branch you pulled from) using a
3-way merge
1137 algorithm. It tries to carefully detect criss-cross
1138 merge ambiguities and is considered generally safe and
1142 <dt class=
"hdlist1">
1147 This can only resolve two heads using a
3-way merge
1148 algorithm. When there is more than one common
1149 ancestor that can be used for
3-way merge, it creates a
1150 merged tree of the common ancestors and uses that as
1151 the reference tree for the
3-way merge. This has been
1152 reported to result in fewer merge conflicts without
1153 causing mis-merges by tests done on actual merge commits
1154 taken from Linux
2.6 kernel development history.
1155 Additionally this can detect and handle merges involving
1156 renames. This is the default merge strategy when
1157 pulling or merging one branch.
1159 <div class=
"paragraph"><p>The
<em>recursive
</em> strategy can take the following options:
</p></div>
1160 <div class=
"dlist"><dl>
1161 <dt class=
"hdlist1">
1166 This option forces conflicting hunks to be auto-resolved cleanly by
1167 favoring
<em>our
</em> version. Changes from the other tree that do not
1168 conflict with our side are reflected to the merge result.
1170 <div class=
"paragraph"><p>This should not be confused with the
<em>ours
</em> merge strategy, which does not
1171 even look at what the other tree contains at all. It discards everything
1172 the other tree did, declaring
<em>our
</em> history contains all that happened in it.
</p></div>
1174 <dt class=
"hdlist1">
1179 This is opposite of
<em>ours
</em>.
1182 <dt class=
"hdlist1">
1187 With this option,
<em>merge-recursive
</em> spends a little extra time
1188 to avoid mismerges that sometimes occur due to unimportant
1189 matching lines (e.g., braces from distinct functions). Use
1190 this when the branches to be merged have diverged wildly.
1191 See also
<a href=
"git-diff.html">git-diff(
1)
</a> <tt>--patience
</tt>.
1194 <dt class=
"hdlist1">
1197 <dt class=
"hdlist1">
1200 <dt class=
"hdlist1">
1205 Treats lines with the indicated type of whitespace change as
1206 unchanged for the sake of a three-way merge. Whitespace
1207 changes mixed with other changes to a line are not ignored.
1208 See also
<a href=
"git-diff.html">git-diff(
1)
</a> <tt>-b
</tt>,
<tt>-w
</tt>, and
1209 <tt>--ignore-space-at-eol
</tt>.
1211 <div class=
"ulist"><ul>
1214 If
<em>their
</em> version only introduces whitespace changes to a line,
1215 <em>our
</em> version is used;
1220 If
<em>our
</em> version introduces whitespace changes but
<em>their
</em>
1221 version includes a substantial change,
<em>their
</em> version is used;
1226 Otherwise, the merge proceeds in the usual way.
1231 <dt class=
"hdlist1">
1236 This runs a virtual check-out and check-in of all three stages
1237 of a file when resolving a three-way merge. This option is
1238 meant to be used when merging branches with different clean
1239 filters or end-of-line normalization rules. See
"Merging
1240 branches with differing checkin/checkout attributes" in
1241 <a href=
"gitattributes.html">gitattributes(
5)
</a> for details.
1244 <dt class=
"hdlist1">
1249 Disables the
<tt>renormalize
</tt> option. This overrides the
1250 <tt>merge.renormalize
</tt> configuration variable.
1253 <dt class=
"hdlist1">
1254 rename-threshold=
<n
>
1258 Controls the similarity threshold used for rename detection.
1259 See also
<a href=
"git-diff.html">git-diff(
1)
</a> <tt>-M
</tt>.
1262 <dt class=
"hdlist1">
1263 subtree[=
<path
>]
1267 This option is a more advanced form of
<em>subtree
</em> strategy, where
1268 the strategy makes a guess on how two trees must be shifted to
1269 match with each other when merging. Instead, the specified path
1270 is prefixed (or stripped from the beginning) to make the shape of
1276 <dt class=
"hdlist1">
1281 This resolves cases with more than two heads, but refuses to do
1282 a complex merge that needs manual resolution. It is
1283 primarily meant to be used for bundling topic branch
1284 heads together. This is the default merge strategy when
1285 pulling or merging more than one branch.
1288 <dt class=
"hdlist1">
1293 This resolves any number of heads, but the resulting tree of the
1294 merge is always that of the current branch head, effectively
1295 ignoring all changes from all other branches. It is meant to
1296 be used to supersede old development history of side
1297 branches. Note that this is different from the -Xours option to
1298 the
<em>recursive
</em> merge strategy.
1301 <dt class=
"hdlist1">
1306 This is a modified recursive strategy. When merging trees A and
1307 B, if B corresponds to a subtree of A, B is first adjusted to
1308 match the tree structure of A, instead of reading the trees at
1309 the same level. This adjustment is also done to the common
1315 <h2 id=
"_default_behaviour">DEFAULT BEHAVIOUR
</h2>
1316 <div class=
"sectionbody">
1317 <div class=
"paragraph"><p>Often people use
<tt>git pull
</tt> without giving any parameter.
1318 Traditionally, this has been equivalent to saying
<tt>git pull
1319 origin
</tt>. However, when configuration
<tt>branch.
<name
>.remote
</tt> is
1320 present while on branch
<tt><name
></tt>, that value is used instead of
1321 <tt>origin
</tt>.
</p></div>
1322 <div class=
"paragraph"><p>In order to determine what URL to use to fetch from, the value
1323 of the configuration
<tt>remote.
<origin
>.url
</tt> is consulted
1324 and if there is not any such variable, the value on
<tt>URL: ` line
1325 in `$GIT_DIR/remotes/
<origin
></tt> file is used.
</p></div>
1326 <div class=
"paragraph"><p>In order to determine what remote branches to fetch (and
1327 optionally store in the remote-tracking branches) when the command is
1328 run without any refspec parameters on the command line, values
1329 of the configuration variable
<tt>remote.
<origin
>.fetch
</tt> are
1330 consulted, and if there aren
’t any,
<tt>$GIT_DIR/remotes/
<origin
></tt>
1331 file is consulted and its `Pull: ` lines are used.
1332 In addition to the refspec formats described in the OPTIONS
1333 section, you can have a globbing refspec that looks like this:
</p></div>
1334 <div class=
"listingblock">
1335 <div class=
"content">
1336 <pre><tt>refs/heads/*:refs/remotes/origin/*
</tt></pre>
1338 <div class=
"paragraph"><p>A globbing refspec must have a non-empty RHS (i.e. must store
1339 what were fetched in remote-tracking branches), and its LHS and RHS
1340 must end with
<tt>/*
</tt>. The above specifies that all remote
1341 branches are tracked using remote-tracking branches in
1342 <tt>refs/remotes/origin/
</tt> hierarchy under the same name.
</p></div>
1343 <div class=
"paragraph"><p>The rule to determine which remote branch to merge after
1344 fetching is a bit involved, in order not to break backward
1345 compatibility.
</p></div>
1346 <div class=
"paragraph"><p>If explicit refspecs were given on the command
1347 line of
<tt>git pull
</tt>, they are all merged.
</p></div>
1348 <div class=
"paragraph"><p>When no refspec was given on the command line, then
<tt>git pull
</tt>
1349 uses the refspec from the configuration or
1350 <tt>$GIT_DIR/remotes/
<origin
></tt>. In such cases, the following
1351 rules apply:
</p></div>
1352 <div class=
"olist arabic"><ol class=
"arabic">
1355 If
<tt>branch.
<name
>.merge
</tt> configuration for the current
1356 branch
<tt><name
></tt> exists, that is the name of the branch at the
1357 remote site that is merged.
1362 If the refspec is a globbing one, nothing is merged.
1367 Otherwise the remote branch of the first refspec is merged.
1372 <h2 id=
"_examples">EXAMPLES
</h2>
1373 <div class=
"sectionbody">
1374 <div class=
"ulist"><ul>
1377 Update the remote-tracking branches for the repository
1378 you cloned from, then merge one of them into your
1381 <div class=
"listingblock">
1382 <div class=
"content">
1383 <pre><tt>$ git pull, git pull origin
</tt></pre>
1385 <div class=
"paragraph"><p>Normally the branch merged in is the HEAD of the remote repository,
1386 but the choice is determined by the branch.
<name
>.remote and
1387 branch.
<name
>.merge options; see
<a href=
"git-config.html">git-config(
1)
</a> for details.
</p></div>
1391 Merge into the current branch the remote branch
<tt>next
</tt>:
1393 <div class=
"listingblock">
1394 <div class=
"content">
1395 <pre><tt>$ git pull origin next
</tt></pre>
1397 <div class=
"paragraph"><p>This leaves a copy of
<tt>next
</tt> temporarily in FETCH_HEAD, but
1398 does not update any remote-tracking branches. Using remote-tracking
1399 branches, the same can be done by invoking fetch and merge:
</p></div>
1400 <div class=
"listingblock">
1401 <div class=
"content">
1402 <pre><tt>$ git fetch origin
1403 $ git merge origin/next
</tt></pre>
1407 <div class=
"paragraph"><p>If you tried a pull which resulted in a complex conflicts and
1408 would want to start over, you can recover with
<em>git reset
</em>.
</p></div>
1410 <h2 id=
"_see_also">SEE ALSO
</h2>
1411 <div class=
"sectionbody">
1412 <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>
1414 <h2 id=
"_author">Author
</h2>
1415 <div class=
"sectionbody">
1416 <div class=
"paragraph"><p>Written by Linus Torvalds
<<a href=
"mailto:torvalds@osdl.org">torvalds@osdl.org
</a>>
1417 and Junio C Hamano
<<a href=
"mailto:gitster@pobox.com">gitster@pobox.com
</a>></p></div>
1419 <h2 id=
"_documentation">Documentation
</h2>
1420 <div class=
"sectionbody">
1421 <div class=
"paragraph"><p>Documentation by Jon Loeliger,
1423 Junio C Hamano and the git-list
<<a href=
"mailto:git@vger.kernel.org">git@vger.kernel.org
</a>>.
</p></div>
1425 <h2 id=
"_git">GIT
</h2>
1426 <div class=
"sectionbody">
1427 <div class=
"paragraph"><p>Part of the
<a href=
"git.html">git(
1)
</a> suite
</p></div>
1430 <div id=
"footer-text">
1431 Last updated
2011-
02-
08 00:
49:
11 UTC