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 <h3 id=
"_options_related_to_merging">Options related to merging
</h3><div style=
"clear:left"></div>
498 <div class=
"dlist"><dl>
507 Perform the merge and commit the result. This option can
508 be used to override --no-commit.
510 <div class=
"paragraph"><p>With --no-commit perform the merge but pretend the merge
511 failed and do not autocommit, to give the user a chance to
512 inspect and further tweak the merge result before committing.
</p></div>
522 Do not generate a merge commit if the merge resolved as
523 a fast-forward, only update the branch pointer. This is
524 the default behavior of git-merge.
526 <div class=
"paragraph"><p>With --no-ff Generate a merge commit even if the merge
527 resolved as a fast-forward.
</p></div>
537 In addition to branch names, populate the log message with
538 one-line descriptions from at most
<n
> actual commits that are being
539 merged. See also
<a href=
"git-fmt-merge-msg.html">git-fmt-merge-msg(
1)
</a>.
541 <div class=
"paragraph"><p>With --no-log do not list one-line descriptions from the
542 actual commits being merged.
</p></div>
555 Show a diffstat at the end of the merge. The diffstat is also
556 controlled by the configuration option merge.stat.
558 <div class=
"paragraph"><p>With -n or --no-stat do not show a diffstat at the end of the
569 Produce the working tree and index state as if a real
570 merge happened (except for the merge information),
571 but do not actually make a commit or
572 move the
<tt>HEAD
</tt>, nor record
<tt>$GIT_DIR/MERGE_HEAD
</tt> to
573 cause the next
<tt>git commit
</tt> command to create a merge
574 commit. This allows you to create a single commit on
575 top of the current branch whose effect is the same as
576 merging another branch (or more in case of an octopus).
578 <div class=
"paragraph"><p>With --no-squash perform the merge and commit the result. This
579 option can be used to override --squash.
</p></div>
586 Refuse to merge and exit with a non-zero status unless the
587 current
<tt>HEAD
</tt> is already up-to-date or the merge can be
588 resolved as a fast-forward.
595 --strategy=
<strategy
>
599 Use the given merge strategy; can be supplied more than
600 once to specify them in the order they should be tried.
601 If there is no
<tt>-s
</tt> option, a built-in list of strategies
602 is used instead (
<em>git merge-recursive
</em> when merging a single
603 head,
<em>git merge-octopus
</em> otherwise).
610 --strategy-option=
<option
>
614 Pass merge strategy specific option through to the merge
626 Synonyms to --stat and --no-stat; these are deprecated and will be
627 removed in the future.
653 <div class=
"dlist"><dl>
659 Rebase the current branch on top of the upstream branch after
660 fetching. If there is a remote-tracking branch corresponding to
661 the upstream branch and the upstream branch was rebased since last
662 fetched, the rebase uses that information to avoid rebasing
665 <div class=
"paragraph"><p>See
<tt>branch.
<name
>.rebase
</tt> and
<tt>branch.autosetuprebase
</tt> in
666 <a href=
"git-config.html">git-config(
1)
</a> if you want to make
<tt>git pull
</tt> always use
667 <tt>--rebase
</tt> instead of merging.
</p></div>
668 <div class=
"admonitionblock">
671 <div class=
"title">Note
</div>
673 <td class=
"content">This is a potentially
<em>dangerous
</em> mode of operation.
674 It rewrites history, which does not bode well when you
675 published that history already. Do
<strong>not
</strong> use this option
676 unless you have read
<a href=
"git-rebase.html">git-rebase(
1)
</a> carefully.
</td>
685 Override earlier --rebase.
689 <h3 id=
"_options_related_to_fetching">Options related to fetching
</h3><div style=
"clear:left"></div>
690 <div class=
"dlist"><dl>
707 Append ref names and object names of fetched refs to the
708 existing contents of
<tt>.git/FETCH_HEAD
</tt>. Without this
709 option old data in
<tt>.git/FETCH_HEAD
</tt> will be overwritten.
713 --depth=
<depth
>
717 Deepen the history of a
<em>shallow
</em> repository created by
718 <tt>git clone
</tt> with
<tt>--depth=
<depth
></tt> option (see
<a href=
"git-clone.html">git-clone(
1)
</a>)
719 by the specified number of commits.
730 When
<em>git fetch
</em> is used with
<tt><rbranch
>:
<lbranch
></tt>
731 refspec, it refuses to update the local branch
732 <tt><lbranch
></tt> unless the remote branch
<tt><rbranch
></tt> it
733 fetches is a descendant of
<tt><lbranch
></tt>. This option
734 overrides that check.
745 Keep downloaded pack.
753 By default, tags that point at objects that are downloaded
754 from the remote repository are fetched and stored locally.
755 This option disables this automatic tag following. The default
756 behavior for a remote may be specified with the remote.
<name
>.tagopt
757 setting. See
<a href=
"git-config.html">git-config(
1)
</a>.
761 --[no-]recurse-submodules
765 This option controls if new commits of all populated submodules should
766 be fetched too (see
<a href=
"git-config.html">git-config(
1)
</a> and
<a href=
"gitmodules.html">gitmodules(
5)
</a>).
777 By default
<em>git fetch
</em> refuses to update the head which
778 corresponds to the current branch. This flag disables the
779 check. This is purely for the internal use for
<em>git pull
</em>
780 to communicate with
<em>git fetch
</em>, and unless you are
781 implementing your own Porcelain you are not supposed to
786 --upload-pack
<upload-pack
>
790 When given, and the repository to fetch from is handled
791 by
<em>git fetch-pack
</em>,
<em>--exec=
<upload-pack
></em> is passed to
792 the command to specify non-default path for the command
793 run on the other end.
801 Progress status is reported on the standard error stream
802 by default when it is attached to a terminal, unless -q
803 is specified. This flag forces progress status even if the
804 standard error stream is not directed to a terminal.
812 The
"remote" repository that is the source of a fetch
813 or pull operation. This parameter can be either a URL
814 (see the section
<a href=
"#URLS">GIT URLS
</a> below) or the name
815 of a remote (see the section
<a href=
"#REMOTES">REMOTES
</a> below).
823 The format of a
<refspec
> parameter is an optional plus
824 <tt>+</tt>, followed by the source ref
<src
>, followed
825 by a colon
<tt>:
</tt>, followed by the destination ref
<dst
>.
827 <div class=
"paragraph"><p>The remote ref that matches
<src
>
828 is fetched, and if
<dst
> is not empty string, the local
829 ref that matches it is fast-forwarded using
<src
>.
830 If the optional plus
<tt>+
</tt> is used, the local ref
831 is updated even if it does not result in a fast-forward
833 <div class=
"admonitionblock">
836 <div class=
"title">Note
</div>
838 <td class=
"content">If the remote branch from which you want to pull is
839 modified in non-linear ways such as being rewound and
840 rebased frequently, then a pull will attempt a merge with
841 an older version of itself, likely conflict, and fail.
842 It is under these conditions that you would want to use
843 the
<tt>+
</tt> sign to indicate non-fast-forward updates will
844 be needed. There is currently no easy way to determine
845 or declare that a branch will be made available in a
846 repository with this behavior; the pulling user simply
847 must know this is the expected usage pattern for a branch.
</td>
850 <div class=
"admonitionblock">
853 <div class=
"title">Note
</div>
855 <td class=
"content">You never do your own development on branches that appear
856 on the right hand side of a
<refspec
> colon on
<tt>Pull:
</tt> lines;
857 they are to be updated by
<em>git fetch
</em>. If you intend to do
858 development derived from a remote branch
<tt>B
</tt>, have a
<tt>Pull:
</tt>
859 line to track it (i.e.
<tt>Pull: B:remote-B
</tt>), and have a separate
860 branch
<tt>my-B
</tt> to do your development on top of it. The latter
861 is created by
<tt>git branch my-B remote-B
</tt> (or its equivalent
<tt>git
862 checkout -b my-B remote-B
</tt>). Run
<tt>git fetch
</tt> to keep track of
863 the progress of the remote side, and when you see something new
864 on the remote branch, merge it into your development branch with
865 <tt>git pull . remote-B
</tt>, while you are on
<tt>my-B
</tt> branch.
</td>
868 <div class=
"admonitionblock">
871 <div class=
"title">Note
</div>
873 <td class=
"content">There is a difference between listing multiple
<refspec
>
874 directly on
<em>git pull
</em> command line and having multiple
875 <tt>Pull:
</tt> <refspec
> lines for a
<repository
> and running
876 <em>git pull
</em> command without any explicit
<refspec
> parameters.
877 <refspec
> listed explicitly on the command line are always
878 merged into the current branch after fetching. In other words,
879 if you list more than one remote refs, you would be making
880 an Octopus. While
<em>git pull
</em> run without any explicit
<refspec
>
881 parameter takes default
<refspec
>s from
<tt>Pull:
</tt> lines, it
882 merges only the first
<refspec
> found into the current branch,
883 after fetching all the remote refs. This is because making an
884 Octopus from remote refs is rarely done, while keeping track
885 of multiple remote heads in one-go by fetching more than one
886 is often useful.
</td>
889 <div class=
"paragraph"><p>Some short-cut notations are also supported.
</p></div>
890 <div class=
"ulist"><ul>
893 <tt>tag
<tag
></tt> means the same as
<tt>refs/tags/
<tag
>:refs/tags/
<tag
></tt>;
894 it requests fetching everything up to the given tag.
899 A parameter
<ref
> without a colon is equivalent to
900 <ref
>: when pulling/fetching, so it merges
<ref
> into the current
901 branch without storing the remote branch anywhere locally
908 <h2 id=
"_git_urls_a_id_urls_a">GIT URLS
<a id=
"URLS"></a></h2>
909 <div class=
"sectionbody">
910 <div class=
"paragraph"><p>In general, URLs contain information about the transport protocol, the
911 address of the remote server, and the path to the repository.
912 Depending on the transport protocol, some of this information may be
914 <div class=
"paragraph"><p>Git natively supports ssh, git, http, https, ftp, ftps, and rsync
915 protocols. The following syntaxes may be used with them:
</p></div>
916 <div class=
"ulist"><ul>
919 ssh://
[user@
]host.xz
[:port
]/path/to/repo.git/
924 git://host.xz
[:port
]/path/to/repo.git/
929 http
[s
]://host.xz
[:port
]/path/to/repo.git/
934 ftp
[s
]://host.xz
[:port
]/path/to/repo.git/
939 rsync://host.xz/path/to/repo.git/
943 <div class=
"paragraph"><p>An alternative scp-like syntax may also be used with the ssh protocol:
</p></div>
944 <div class=
"ulist"><ul>
947 [user@
]host.xz:path/to/repo.git/
951 <div class=
"paragraph"><p>The ssh and git protocols additionally support ~username expansion:
</p></div>
952 <div class=
"ulist"><ul>
955 ssh://
[user@
]host.xz
[:port
]/~
[user
]/path/to/repo.git/
960 git://host.xz
[:port
]/~
[user
]/path/to/repo.git/
965 [user@
]host.xz:/~
[user
]/path/to/repo.git/
969 <div class=
"paragraph"><p>For local repositories, also supported by git natively, the following
970 syntaxes may be used:
</p></div>
971 <div class=
"ulist"><ul>
979 <a href=
"file:///path/to/repo.git/">file:///path/to/repo.git/
</a>
983 <div class=
"paragraph"><p>These two syntaxes are mostly equivalent, except when cloning, when
984 the former implies --local option. See
<a href=
"git-clone.html">git-clone(
1)
</a> for
986 <div class=
"paragraph"><p>When git doesn
’t know how to handle a certain transport protocol, it
987 attempts to use the
<em>remote-
<transport
></em> remote helper, if one
988 exists. To explicitly request a remote helper, the following syntax
989 may be used:
</p></div>
990 <div class=
"ulist"><ul>
993 <transport
>::
<address
>
997 <div class=
"paragraph"><p>where
<address
> may be a path, a server and path, or an arbitrary
998 URL-like string recognized by the specific remote helper being
999 invoked. See
<a href=
"git-remote-helpers.html">git-remote-helpers(
1)
</a> for details.
</p></div>
1000 <div class=
"paragraph"><p>If there are a large number of similarly-named remote repositories and
1001 you want to use a different format for them (such that the URLs you
1002 use will be rewritten into URLs that work), you can create a
1003 configuration section of the form:
</p></div>
1004 <div class=
"listingblock">
1005 <div class=
"content">
1006 <pre><tt> [url
"<actual url base>"]
1007 insteadOf =
<other url base
></tt></pre>
1009 <div class=
"paragraph"><p>For example, with this:
</p></div>
1010 <div class=
"listingblock">
1011 <div class=
"content">
1012 <pre><tt> [url
"git://git.host.xz/"]
1013 insteadOf = host.xz:/path/to/
1014 insteadOf = work:
</tt></pre>
1016 <div class=
"paragraph"><p>a URL like
"work:repo.git" or like
"host.xz:/path/to/repo.git" will be
1017 rewritten in any context that takes a URL to be
"git://git.host.xz/repo.git".
</p></div>
1018 <div class=
"paragraph"><p>If you want to rewrite URLs for push only, you can create a
1019 configuration section of the form:
</p></div>
1020 <div class=
"listingblock">
1021 <div class=
"content">
1022 <pre><tt> [url
"<actual url base>"]
1023 pushInsteadOf =
<other url base
></tt></pre>
1025 <div class=
"paragraph"><p>For example, with this:
</p></div>
1026 <div class=
"listingblock">
1027 <div class=
"content">
1028 <pre><tt> [url
"ssh://example.org/"]
1029 pushInsteadOf = git://example.org/
</tt></pre>
1031 <div class=
"paragraph"><p>a URL like
"git://example.org/path/to/repo.git" will be rewritten to
1032 "ssh://example.org/path/to/repo.git" for pushes, but pulls will still
1033 use the original URL.
</p></div>
1035 <h2 id=
"_remotes_a_id_remotes_a">REMOTES
<a id=
"REMOTES"></a></h2>
1036 <div class=
"sectionbody">
1037 <div class=
"paragraph"><p>The name of one of the following can be used instead
1038 of a URL as
<tt><repository
></tt> argument:
</p></div>
1039 <div class=
"ulist"><ul>
1042 a remote in the git configuration file:
<tt>$GIT_DIR/config
</tt>,
1047 a file in the
<tt>$GIT_DIR/remotes
</tt> directory, or
1052 a file in the
<tt>$GIT_DIR/branches
</tt> directory.
1056 <div class=
"paragraph"><p>All of these also allow you to omit the refspec from the command line
1057 because they each contain a refspec which git will use by default.
</p></div>
1058 <h3 id=
"_named_remote_in_configuration_file">Named remote in configuration file
</h3><div style=
"clear:left"></div>
1059 <div class=
"paragraph"><p>You can choose to provide the name of a remote which you had previously
1060 configured using
<a href=
"git-remote.html">git-remote(
1)
</a>,
<a href=
"git-config.html">git-config(
1)
</a>
1061 or even by a manual edit to the
<tt>$GIT_DIR/config
</tt> file. The URL of
1062 this remote will be used to access the repository. The refspec
1063 of this remote will be used by default when you do
1064 not provide a refspec on the command line. The entry in the
1065 config file would appear like this:
</p></div>
1066 <div class=
"listingblock">
1067 <div class=
"content">
1068 <pre><tt> [remote
"<name>"]
1070 pushurl =
<pushurl
>
1071 push =
<refspec
>
1072 fetch =
<refspec
></tt></pre>
1074 <div class=
"paragraph"><p>The
<tt><pushurl
></tt> is used for pushes only. It is optional and defaults
1075 to
<tt><url
></tt>.
</p></div>
1076 <h3 id=
"_named_file_in_tt_git_dir_remotes_tt">Named file in
<tt>$GIT_DIR/remotes
</tt></h3><div style=
"clear:left"></div>
1077 <div class=
"paragraph"><p>You can choose to provide the name of a
1078 file in
<tt>$GIT_DIR/remotes
</tt>. The URL
1079 in this file will be used to access the repository. The refspec
1080 in this file will be used as default when you do not
1081 provide a refspec on the command line. This file should have the
1082 following format:
</p></div>
1083 <div class=
"listingblock">
1084 <div class=
"content">
1085 <pre><tt> URL: one of the above URL format
1086 Push:
<refspec
>
1087 Pull:
<refspec
></tt></pre>
1089 <div class=
"paragraph"><p><tt>Push:
</tt> lines are used by
<em>git push
</em> and
1090 <tt>Pull:
</tt> lines are used by
<em>git pull
</em> and
<em>git fetch
</em>.
1091 Multiple
<tt>Push:
</tt> and
<tt>Pull:
</tt> lines may
1092 be specified for additional branch mappings.
</p></div>
1093 <h3 id=
"_named_file_in_tt_git_dir_branches_tt">Named file in
<tt>$GIT_DIR/branches
</tt></h3><div style=
"clear:left"></div>
1094 <div class=
"paragraph"><p>You can choose to provide the name of a
1095 file in
<tt>$GIT_DIR/branches
</tt>.
1096 The URL in this file will be used to access the repository.
1097 This file should have the following format:
</p></div>
1098 <div class=
"listingblock">
1099 <div class=
"content">
1100 <pre><tt> <url
>#
<head
></tt></pre>
1102 <div class=
"paragraph"><p><tt><url
></tt> is required;
<tt>#
<head
></tt> is optional.
</p></div>
1103 <div class=
"paragraph"><p>Depending on the operation, git will use one of the following
1104 refspecs, if you don
’t provide one on the command line.
1105 <tt><branch
></tt> is the name of this file in
<tt>$GIT_DIR/branches
</tt> and
1106 <tt><head
></tt> defaults to
<tt>master
</tt>.
</p></div>
1107 <div class=
"paragraph"><p>git fetch uses:
</p></div>
1108 <div class=
"listingblock">
1109 <div class=
"content">
1110 <pre><tt> refs/heads/
<head
>:refs/heads/
<branch
></tt></pre>
1112 <div class=
"paragraph"><p>git push uses:
</p></div>
1113 <div class=
"listingblock">
1114 <div class=
"content">
1115 <pre><tt> HEAD:refs/heads/
<head
></tt></pre>
1118 <h2 id=
"_merge_strategies">MERGE STRATEGIES
</h2>
1119 <div class=
"sectionbody">
1120 <div class=
"paragraph"><p>The merge mechanism (
<em>git-merge
</em> and
<em>git-pull
</em> commands) allows the
1121 backend
<em>merge strategies
</em> to be chosen with
<tt>-s
</tt> option. Some strategies
1122 can also take their own options, which can be passed by giving
<tt>-X
<option
></tt>
1123 arguments to
<em>git-merge
</em> and/or
<em>git-pull
</em>.
</p></div>
1124 <div class=
"dlist"><dl>
1125 <dt class=
"hdlist1">
1130 This can only resolve two heads (i.e. the current branch
1131 and another branch you pulled from) using a
3-way merge
1132 algorithm. It tries to carefully detect criss-cross
1133 merge ambiguities and is considered generally safe and
1137 <dt class=
"hdlist1">
1142 This can only resolve two heads using a
3-way merge
1143 algorithm. When there is more than one common
1144 ancestor that can be used for
3-way merge, it creates a
1145 merged tree of the common ancestors and uses that as
1146 the reference tree for the
3-way merge. This has been
1147 reported to result in fewer merge conflicts without
1148 causing mis-merges by tests done on actual merge commits
1149 taken from Linux
2.6 kernel development history.
1150 Additionally this can detect and handle merges involving
1151 renames. This is the default merge strategy when
1152 pulling or merging one branch.
1154 <div class=
"paragraph"><p>The
<em>recursive
</em> strategy can take the following options:
</p></div>
1155 <div class=
"dlist"><dl>
1156 <dt class=
"hdlist1">
1161 This option forces conflicting hunks to be auto-resolved cleanly by
1162 favoring
<em>our
</em> version. Changes from the other tree that do not
1163 conflict with our side are reflected to the merge result.
1165 <div class=
"paragraph"><p>This should not be confused with the
<em>ours
</em> merge strategy, which does not
1166 even look at what the other tree contains at all. It discards everything
1167 the other tree did, declaring
<em>our
</em> history contains all that happened in it.
</p></div>
1169 <dt class=
"hdlist1">
1174 This is opposite of
<em>ours
</em>.
1177 <dt class=
"hdlist1">
1182 With this option,
<em>merge-recursive
</em> spends a little extra time
1183 to avoid mismerges that sometimes occur due to unimportant
1184 matching lines (e.g., braces from distinct functions). Use
1185 this when the branches to be merged have diverged wildly.
1186 See also
<a href=
"git-diff.html">git-diff(
1)
</a> <tt>--patience
</tt>.
1189 <dt class=
"hdlist1">
1192 <dt class=
"hdlist1">
1195 <dt class=
"hdlist1">
1200 Treats lines with the indicated type of whitespace change as
1201 unchanged for the sake of a three-way merge. Whitespace
1202 changes mixed with other changes to a line are not ignored.
1203 See also
<a href=
"git-diff.html">git-diff(
1)
</a> <tt>-b
</tt>,
<tt>-w
</tt>, and
1204 <tt>--ignore-space-at-eol
</tt>.
1206 <div class=
"ulist"><ul>
1209 If
<em>their
</em> version only introduces whitespace changes to a line,
1210 <em>our
</em> version is used;
1215 If
<em>our
</em> version introduces whitespace changes but
<em>their
</em>
1216 version includes a substantial change,
<em>their
</em> version is used;
1221 Otherwise, the merge proceeds in the usual way.
1226 <dt class=
"hdlist1">
1231 This runs a virtual check-out and check-in of all three stages
1232 of a file when resolving a three-way merge. This option is
1233 meant to be used when merging branches with different clean
1234 filters or end-of-line normalization rules. See
"Merging
1235 branches with differing checkin/checkout attributes" in
1236 <a href=
"gitattributes.html">gitattributes(
5)
</a> for details.
1239 <dt class=
"hdlist1">
1244 Disables the
<tt>renormalize
</tt> option. This overrides the
1245 <tt>merge.renormalize
</tt> configuration variable.
1248 <dt class=
"hdlist1">
1249 rename-threshold=
<n
>
1253 Controls the similarity threshold used for rename detection.
1254 See also
<a href=
"git-diff.html">git-diff(
1)
</a> <tt>-M
</tt>.
1257 <dt class=
"hdlist1">
1258 subtree[=
<path
>]
1262 This option is a more advanced form of
<em>subtree
</em> strategy, where
1263 the strategy makes a guess on how two trees must be shifted to
1264 match with each other when merging. Instead, the specified path
1265 is prefixed (or stripped from the beginning) to make the shape of
1271 <dt class=
"hdlist1">
1276 This resolves cases with more than two heads, but refuses to do
1277 a complex merge that needs manual resolution. It is
1278 primarily meant to be used for bundling topic branch
1279 heads together. This is the default merge strategy when
1280 pulling or merging more than one branch.
1283 <dt class=
"hdlist1">
1288 This resolves any number of heads, but the resulting tree of the
1289 merge is always that of the current branch head, effectively
1290 ignoring all changes from all other branches. It is meant to
1291 be used to supersede old development history of side
1292 branches. Note that this is different from the -Xours option to
1293 the
<em>recursive
</em> merge strategy.
1296 <dt class=
"hdlist1">
1301 This is a modified recursive strategy. When merging trees A and
1302 B, if B corresponds to a subtree of A, B is first adjusted to
1303 match the tree structure of A, instead of reading the trees at
1304 the same level. This adjustment is also done to the common
1310 <h2 id=
"_default_behaviour">DEFAULT BEHAVIOUR
</h2>
1311 <div class=
"sectionbody">
1312 <div class=
"paragraph"><p>Often people use
<tt>git pull
</tt> without giving any parameter.
1313 Traditionally, this has been equivalent to saying
<tt>git pull
1314 origin
</tt>. However, when configuration
<tt>branch.
<name
>.remote
</tt> is
1315 present while on branch
<tt><name
></tt>, that value is used instead of
1316 <tt>origin
</tt>.
</p></div>
1317 <div class=
"paragraph"><p>In order to determine what URL to use to fetch from, the value
1318 of the configuration
<tt>remote.
<origin
>.url
</tt> is consulted
1319 and if there is not any such variable, the value on
<tt>URL: ` line
1320 in `$GIT_DIR/remotes/
<origin
></tt> file is used.
</p></div>
1321 <div class=
"paragraph"><p>In order to determine what remote branches to fetch (and
1322 optionally store in the remote-tracking branches) when the command is
1323 run without any refspec parameters on the command line, values
1324 of the configuration variable
<tt>remote.
<origin
>.fetch
</tt> are
1325 consulted, and if there aren
’t any,
<tt>$GIT_DIR/remotes/
<origin
></tt>
1326 file is consulted and its `Pull: ` lines are used.
1327 In addition to the refspec formats described in the OPTIONS
1328 section, you can have a globbing refspec that looks like this:
</p></div>
1329 <div class=
"listingblock">
1330 <div class=
"content">
1331 <pre><tt>refs/heads/*:refs/remotes/origin/*
</tt></pre>
1333 <div class=
"paragraph"><p>A globbing refspec must have a non-empty RHS (i.e. must store
1334 what were fetched in remote-tracking branches), and its LHS and RHS
1335 must end with
<tt>/*
</tt>. The above specifies that all remote
1336 branches are tracked using remote-tracking branches in
1337 <tt>refs/remotes/origin/
</tt> hierarchy under the same name.
</p></div>
1338 <div class=
"paragraph"><p>The rule to determine which remote branch to merge after
1339 fetching is a bit involved, in order not to break backward
1340 compatibility.
</p></div>
1341 <div class=
"paragraph"><p>If explicit refspecs were given on the command
1342 line of
<tt>git pull
</tt>, they are all merged.
</p></div>
1343 <div class=
"paragraph"><p>When no refspec was given on the command line, then
<tt>git pull
</tt>
1344 uses the refspec from the configuration or
1345 <tt>$GIT_DIR/remotes/
<origin
></tt>. In such cases, the following
1346 rules apply:
</p></div>
1347 <div class=
"olist arabic"><ol class=
"arabic">
1350 If
<tt>branch.
<name
>.merge
</tt> configuration for the current
1351 branch
<tt><name
></tt> exists, that is the name of the branch at the
1352 remote site that is merged.
1357 If the refspec is a globbing one, nothing is merged.
1362 Otherwise the remote branch of the first refspec is merged.
1367 <h2 id=
"_examples">EXAMPLES
</h2>
1368 <div class=
"sectionbody">
1369 <div class=
"ulist"><ul>
1372 Update the remote-tracking branches for the repository
1373 you cloned from, then merge one of them into your
1376 <div class=
"listingblock">
1377 <div class=
"content">
1378 <pre><tt>$ git pull, git pull origin
</tt></pre>
1380 <div class=
"paragraph"><p>Normally the branch merged in is the HEAD of the remote repository,
1381 but the choice is determined by the branch.
<name
>.remote and
1382 branch.
<name
>.merge options; see
<a href=
"git-config.html">git-config(
1)
</a> for details.
</p></div>
1386 Merge into the current branch the remote branch
<tt>next
</tt>:
1388 <div class=
"listingblock">
1389 <div class=
"content">
1390 <pre><tt>$ git pull origin next
</tt></pre>
1392 <div class=
"paragraph"><p>This leaves a copy of
<tt>next
</tt> temporarily in FETCH_HEAD, but
1393 does not update any remote-tracking branches. Using remote-tracking
1394 branches, the same can be done by invoking fetch and merge:
</p></div>
1395 <div class=
"listingblock">
1396 <div class=
"content">
1397 <pre><tt>$ git fetch origin
1398 $ git merge origin/next
</tt></pre>
1402 <div class=
"paragraph"><p>If you tried a pull which resulted in a complex conflicts and
1403 would want to start over, you can recover with
<em>git reset
</em>.
</p></div>
1405 <h2 id=
"_see_also">SEE ALSO
</h2>
1406 <div class=
"sectionbody">
1407 <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>
1409 <h2 id=
"_author">Author
</h2>
1410 <div class=
"sectionbody">
1411 <div class=
"paragraph"><p>Written by Linus Torvalds
<<a href=
"mailto:torvalds@osdl.org">torvalds@osdl.org
</a>>
1412 and Junio C Hamano
<<a href=
"mailto:gitster@pobox.com">gitster@pobox.com
</a>></p></div>
1414 <h2 id=
"_documentation">Documentation
</h2>
1415 <div class=
"sectionbody">
1416 <div class=
"paragraph"><p>Documentation by Jon Loeliger,
1418 Junio C Hamano and the git-list
<<a href=
"mailto:git@vger.kernel.org">git@vger.kernel.org
</a>>.
</p></div>
1420 <h2 id=
"_git">GIT
</h2>
1421 <div class=
"sectionbody">
1422 <div class=
"paragraph"><p>Part of the
<a href=
"git.html">git(
1)
</a> suite
</p></div>
1425 <div id=
"footer-text">
1426 Last updated
2010-
12-
13 08:
31:
26 UTC