1 <?xml version="1.0" encoding="UTF-8"?>
\r
2 <!DOCTYPE sect2 SYSTEM "../../../dtd/dblite.dtd">
\r
4 <sect2 lang="en" id="git-pull(1)">
\r
5 <title>git-pull(1)</title>
\r
7 <primary>git-pull(1)</primary>
\r
9 <simplesect id="git-pull(1)__name">
\r
11 <simpara>git-pull - Fetch from and integrate with another repository or a local branch</simpara>
\r
13 <simplesect id="git-pull(1)__synopsis">
\r
14 <title>SYNOPSIS</title>
\r
16 <literallayout><emphasis>git pull</emphasis> [<options>] [<repository> [<refspec>…]]</literallayout>
\r
19 <simplesect id="git-pull(1)__description">
\r
20 <title>DESCRIPTION</title>
\r
21 <simpara>Incorporates changes from a remote repository into the current
\r
22 branch. In its default mode, <emphasis>git pull</emphasis> is shorthand for
\r
23 <emphasis>git fetch</emphasis> followed by <emphasis>git merge FETCH_HEAD</emphasis>.</simpara>
\r
24 <simpara>More precisely, <emphasis>git pull</emphasis> runs <emphasis>git fetch</emphasis> with the given
\r
25 parameters and calls <emphasis>git merge</emphasis> to merge the retrieved branch
\r
26 heads into the current branch.
\r
27 With <emphasis>--rebase</emphasis>, it runs <emphasis>git rebase</emphasis> instead of <emphasis>git merge</emphasis>.</simpara>
\r
28 <simpara><repository> should be the name of a remote repository as
\r
29 passed to <xref linkend="git-fetch(1)" />. <refspec> can name an
\r
30 arbitrary remote ref (for example, the name of a tag) or even
\r
31 a collection of refs with corresponding remote-tracking branches
\r
32 (e.g., refs/heads/*:refs/remotes/origin/*),
\r
33 but usually it is the name of a branch in the remote repository.</simpara>
\r
34 <simpara>Default values for <repository> and <branch> are read from the
\r
35 "remote" and "merge" configuration for the current branch
\r
36 as set by <xref linkend="git-branch(1)" /> <emphasis>--track</emphasis>.</simpara>
\r
37 <simpara>Assume the following history exists and the current branch is
\r
38 "<emphasis>master</emphasis>":</simpara>
\r
39 <screen> A---B---C master on origin
\r
41 D---E---F---G master
\r
43 origin/master in your repository</screen>
\r
44 <simpara>Then "<emphasis>git pull</emphasis>" will fetch and replay the changes from the remote
\r
45 <emphasis>master</emphasis> branch since it diverged from the local <emphasis>master</emphasis> (i.e., <emphasis>E</emphasis>)
\r
46 until its current commit (<emphasis>C</emphasis>) on top of <emphasis>master</emphasis> and record the
\r
47 result in a new commit along with the names of the two parent commits
\r
48 and a log message from the user describing the changes.</simpara>
\r
49 <screen> A---B---C origin/master
\r
51 D---E---F---G---H master</screen>
\r
52 <simpara>See <xref linkend="git-merge(1)" /> for details, including how conflicts
\r
53 are presented and handled.</simpara>
\r
54 <simpara>In Git 1.7.0 or later, to cancel a conflicting merge, use
\r
55 <emphasis>git reset --merge</emphasis>. <emphasis role="strong">Warning</emphasis>: In older versions of Git, running <emphasis>git pull</emphasis>
\r
56 with uncommitted changes is discouraged: while possible, it leaves you
\r
57 in a state that may be hard to back out of in the case of a conflict.</simpara>
\r
58 <simpara>If any of the remote changes overlap with local uncommitted changes,
\r
59 the merge will be automatically canceled and the work tree untouched.
\r
60 It is generally best to get any local changes in working order before
\r
61 pulling or stash them away with <xref linkend="git-stash(1)" />.</simpara>
\r
63 <simplesect id="git-pull(1)__options">
\r
64 <title>OPTIONS</title>
\r
75 This is passed to both underlying git-fetch to squelch reporting of
\r
76 during transfer, and underlying git-merge to squelch output during
\r
90 Pass --verbose to git-fetch and git-merge.
\r
96 --[no-]recurse-submodules[=yes|on-demand|no]
\r
100 This option controls if new commits of populated submodules should
\r
101 be fetched, and if the working trees of active submodules should be
\r
102 updated, too (see <xref linkend="git-fetch(1)" />, <xref linkend="git-config(1)" /> and
\r
103 <xref linkend="gitmodules(5)" />).
\r
105 <simpara>If the checkout is done via rebase, local submodule commits are rebased as well.</simpara>
\r
106 <simpara>If the update is done via merge, the submodule conflicts are resolved and checked out.</simpara>
\r
110 <section id="git-pull(1)__options_related_to_merging">
\r
111 <title>Options related to merging</title>
\r
122 Perform the merge and commit the result. This option can
\r
123 be used to override --no-commit.
\r
125 <simpara>With --no-commit perform the merge and stop just before creating
\r
126 a merge commit, to give the user a chance to inspect and further
\r
127 tweak the merge result before committing.</simpara>
\r
128 <simpara>Note that fast-forward updates do not create a merge commit and
\r
129 therefore there is no way to stop those merges with --no-commit.
\r
130 Thus, if you want to ensure your branch is not changed or updated
\r
131 by the merge command, use --no-ff with --no-commit.</simpara>
\r
146 Invoke an editor before committing successful mechanical merge to
\r
147 further edit the auto-generated merge message, so that the user
\r
148 can explain and justify the merge. The <emphasis>--no-edit</emphasis> option can be
\r
149 used to accept the auto-generated message (this is generally
\r
152 <simpara>Older scripts may depend on the historical behaviour of not allowing the
\r
153 user to edit the merge log message. They will see an editor opened when
\r
154 they run <emphasis>git merge</emphasis>. To make it easier to adjust such scripts to the
\r
155 updated behaviour, the environment variable <emphasis>GIT_MERGE_AUTOEDIT</emphasis> can be
\r
156 set to <emphasis>no</emphasis> at the beginning of them.</simpara>
\r
161 --cleanup=<mode>
\r
165 This option determines how the merge message will be cleaned up before
\r
166 committing. See <xref linkend="git-commit(1)" /> for more details. In addition, if
\r
167 the <emphasis><mode></emphasis> is given a value of <emphasis>scissors</emphasis>, scissors will be appended
\r
168 to <emphasis>MERGE_MSG</emphasis> before being passed on to the commit machinery in the
\r
169 case of a merge conflict.
\r
185 Specifies how a merge is handled when the merged-in history is
\r
186 already a descendant of the current history. <emphasis>--ff</emphasis> is the
\r
187 default unless merging an annotated (and possibly signed) tag
\r
188 that is not stored in its natural place in the <emphasis>refs/tags/</emphasis>
\r
189 hierarchy, in which case <emphasis>--no-ff</emphasis> is assumed.
\r
191 <simpara>With <emphasis>--ff</emphasis>, when possible resolve the merge as a fast-forward (only
\r
192 update the branch pointer to match the merged branch; do not create a
\r
193 merge commit). When not possible (when the merged-in history is not a
\r
194 descendant of the current history), create a merge commit.</simpara>
\r
195 <simpara>With <emphasis>--no-ff</emphasis>, create a merge commit in all cases, even when the merge
\r
196 could instead be resolved as a fast-forward.</simpara>
\r
197 <simpara>With <emphasis>--ff-only</emphasis>, resolve the merge as a fast-forward when possible.
\r
198 When not possible, refuse to merge and exit with a non-zero status.</simpara>
\r
206 --gpg-sign[=<keyid>]
\r
213 GPG-sign the resulting merge commit. The <emphasis>keyid</emphasis> argument is
\r
214 optional and defaults to the committer identity; if specified,
\r
215 it must be stuck to the option without a space. <emphasis>--no-gpg-sign</emphasis>
\r
216 is useful to countermand both <emphasis>commit.gpgSign</emphasis> configuration variable,
\r
217 and earlier <emphasis>--gpg-sign</emphasis>.
\r
230 In addition to branch names, populate the log message with
\r
231 one-line descriptions from at most <n> actual commits that are being
\r
232 merged. See also <xref linkend="git-fmt-merge-msg(1)" />.
\r
234 <simpara>With --no-log do not list one-line descriptions from the
\r
235 actual commits being merged.</simpara>
\r
247 Add Signed-off-by line by the committer at the end of the commit
\r
248 log message. The meaning of a signoff depends on the project,
\r
249 but it typically certifies that committer has
\r
250 the rights to submit this work under the same license and
\r
251 agrees to a Developer Certificate of Origin
\r
252 (see <ulink url="http://developercertificate.org/">http://developercertificate.org/</ulink> for more information).
\r
254 <simpara>With --no-signoff do not add a Signed-off-by line.</simpara>
\r
269 Show a diffstat at the end of the merge. The diffstat is also
\r
270 controlled by the configuration option merge.stat.
\r
272 <simpara>With -n or --no-stat do not show a diffstat at the end of the
\r
285 Produce the working tree and index state as if a real merge
\r
286 happened (except for the merge information), but do not actually
\r
287 make a commit, move the <emphasis>HEAD</emphasis>, or record <emphasis>$GIT_DIR/MERGE_HEAD</emphasis>
\r
288 (to cause the next <emphasis>git commit</emphasis> command to create a merge
\r
289 commit). This allows you to create a single commit on top of
\r
290 the current branch whose effect is the same as merging another
\r
291 branch (or more in case of an octopus).
\r
293 <simpara>With --no-squash perform the merge and commit the result. This
\r
294 option can be used to override --squash.</simpara>
\r
295 <simpara>With --squash, --commit is not allowed, and will fail.</simpara>
\r
304 This option bypasses the pre-merge and commit-msg hooks.
\r
305 See also <xref linkend="githooks(5)" />.
\r
311 -s <strategy>
\r
314 --strategy=<strategy>
\r
318 Use the given merge strategy; can be supplied more than
\r
319 once to specify them in the order they should be tried.
\r
320 If there is no <emphasis>-s</emphasis> option, a built-in list of strategies
\r
321 is used instead (<emphasis>git merge-recursive</emphasis> when merging a single
\r
322 head, <emphasis>git merge-octopus</emphasis> otherwise).
\r
331 --strategy-option=<option>
\r
335 Pass merge strategy specific option through to the merge
\r
342 --verify-signatures
\r
345 --no-verify-signatures
\r
349 Verify that the tip commit of the side branch being merged is
\r
350 signed with a valid key, i.e. a key that has a valid uid: in the
\r
351 default trust model, this means the signing key has been signed by
\r
352 a trusted key. If the tip commit of the side branch is not signed
\r
353 with a valid key, the merge is aborted.
\r
366 Synonyms to --stat and --no-stat; these are deprecated and will be
\r
367 removed in the future.
\r
380 Automatically create a temporary stash entry before the operation
\r
381 begins, and apply it after the operation ends. This means
\r
382 that you can run the operation on a dirty worktree. However, use
\r
383 with care: the final stash application after a successful
\r
384 merge might result in non-trivial conflicts.
\r
390 --allow-unrelated-histories
\r
394 By default, <emphasis>git merge</emphasis> command refuses to merge histories
\r
395 that do not share a common ancestor. This option can be
\r
396 used to override this safety when merging histories of two
\r
397 projects that started their lives independently. As that is
\r
398 a very rare occasion, no configuration variable to enable
\r
399 this by default exists and will not be added.
\r
408 --rebase[=false|true|merges|preserve|interactive]
\r
412 When true, rebase the current branch on top of the upstream
\r
413 branch after fetching. If there is a remote-tracking branch
\r
414 corresponding to the upstream branch and the upstream branch
\r
415 was rebased since last fetched, the rebase uses that information
\r
416 to avoid rebasing non-local changes.
\r
418 <simpara>When set to <emphasis>merges</emphasis>, rebase using <emphasis>git rebase --rebase-merges</emphasis> so that
\r
419 the local merge commits are included in the rebase (see
\r
420 <xref linkend="git-rebase(1)" /> for details).</simpara>
\r
421 <simpara>When set to <emphasis>preserve</emphasis> (deprecated in favor of <emphasis>merges</emphasis>), rebase with the
\r
422 <emphasis>--preserve-merges</emphasis> option passed to <emphasis>git rebase</emphasis> so that locally created
\r
423 merge commits will not be flattened.</simpara>
\r
424 <simpara>When false, merge the current branch into the upstream branch.</simpara>
\r
425 <simpara>When <emphasis>interactive</emphasis>, enable the interactive mode of rebase.</simpara>
\r
426 <simpara>See <emphasis>pull.rebase</emphasis>, <emphasis>branch.<name>.rebase</emphasis> and <emphasis>branch.autoSetupRebase</emphasis> in
\r
427 <xref linkend="git-config(1)" /> if you want to make <emphasis>git pull</emphasis> always use
\r
428 <emphasis>--rebase</emphasis> instead of merging.</simpara>
\r
429 <note><simpara>This is a potentially <emphasis>dangerous</emphasis> mode of operation.
\r
430 It rewrites history, which does not bode well when you
\r
431 published that history already. Do <emphasis role="strong">not</emphasis> use this option
\r
432 unless you have read <xref linkend="git-rebase(1)" /> carefully.</simpara></note>
\r
441 Override earlier --rebase.
\r
447 <section id="git-pull(1)__options_related_to_fetching">
\r
448 <title>Options related to fetching</title>
\r
469 Append ref names and object names of fetched refs to the
\r
470 existing contents of <emphasis>.git/FETCH_HEAD</emphasis>. Without this
\r
471 option old data in <emphasis>.git/FETCH_HEAD</emphasis> will be overwritten.
\r
477 --depth=<depth>
\r
481 Limit fetching to the specified number of commits from the tip of
\r
482 each remote branch history. If fetching to a <emphasis>shallow</emphasis> repository
\r
483 created by <emphasis>git clone</emphasis> with <emphasis>--depth=<depth></emphasis> option (see
\r
484 <xref linkend="git-clone(1)" />), deepen or shorten the history to the specified
\r
485 number of commits. Tags for the deepened commits are not fetched.
\r
491 --deepen=<depth>
\r
495 Similar to --depth, except it specifies the number of commits
\r
496 from the current shallow boundary instead of from the tip of
\r
497 each remote branch history.
\r
503 --shallow-since=<date>
\r
507 Deepen or shorten the history of a shallow repository to
\r
508 include all reachable commits after <date>.
\r
514 --shallow-exclude=<revision>
\r
518 Deepen or shorten the history of a shallow repository to
\r
519 exclude commits reachable from a specified remote branch or tag.
\r
520 This option can be specified multiple times.
\r
530 If the source repository is complete, convert a shallow
\r
531 repository to a complete one, removing all the limitations
\r
532 imposed by shallow repositories.
\r
534 <simpara>If the source repository is shallow, fetch as much as possible so that
\r
535 the current repository has the same history as the source repository.</simpara>
\r
544 By default when fetching from a shallow repository,
\r
545 <emphasis>git fetch</emphasis> refuses refs that require updating
\r
546 .git/shallow. This option updates .git/shallow and accept such
\r
553 --negotiation-tip=<commit|glob>
\r
557 By default, Git will report, to the server, commits reachable
\r
558 from all local refs to find common commits in an attempt to
\r
559 reduce the size of the to-be-received packfile. If specified,
\r
560 Git will only report commits reachable from the given tips.
\r
561 This is useful to speed up fetches when the user knows which
\r
562 local ref is likely to have commits in common with the
\r
563 upstream ref being fetched.
\r
565 <simpara>This option may be specified more than once; if so, Git will report
\r
566 commits reachable from any of the given commits.</simpara>
\r
567 <simpara>The argument to this option may be a glob on ref names, a ref, or the (possibly
\r
568 abbreviated) SHA-1 of a commit. Specifying a glob is equivalent to specifying
\r
569 this option multiple times, one for each matching ref name.</simpara>
\r
570 <simpara>See also the <emphasis>fetch.negotiationAlgorithm</emphasis> configuration variable
\r
571 documented in <xref linkend="git-config(1)" />.</simpara>
\r
580 Show what would be done, without making any changes.
\r
593 When <emphasis>git fetch</emphasis> is used with <emphasis><src>:<dst></emphasis> refspec it may
\r
594 refuse to update the local branch as discussed
\r
595 in the <emphasis><refspec></emphasis> part of the <xref linkend="git-fetch(1)" />
\r
597 This option overrides that check.
\r
610 Keep downloaded pack.
\r
623 Before fetching, remove any remote-tracking references that no
\r
624 longer exist on the remote. Tags are not subject to pruning
\r
625 if they are fetched only because of the default tag
\r
626 auto-following or due to a --tags option. However, if tags
\r
627 are fetched due to an explicit refspec (either on the command
\r
628 line or in the remote configuration, for example if the remote
\r
629 was cloned with the --mirror option), then they are also
\r
630 subject to pruning. Supplying <emphasis>--prune-tags</emphasis> is a shorthand for
\r
631 providing the tag refspec.
\r
641 By default, tags that point at objects that are downloaded
\r
642 from the remote repository are fetched and stored locally.
\r
643 This option disables this automatic tag following. The default
\r
644 behavior for a remote may be specified with the remote.<name>.tagOpt
\r
645 setting. See <xref linkend="git-config(1)" />.
\r
651 --refmap=<refspec>
\r
655 When fetching refs listed on the command line, use the
\r
656 specified refspec (can be given more than once) to map the
\r
657 refs to remote-tracking branches, instead of the values of
\r
658 <emphasis>remote.*.fetch</emphasis> configuration variables for the remote
\r
659 repository. Providing an empty <emphasis><refspec></emphasis> to the
\r
660 <emphasis>--refmap</emphasis> option causes Git to ignore the configured
\r
661 refspecs and rely entirely on the refspecs supplied as
\r
662 command-line arguments. See section on "Configured Remote-tracking
\r
663 Branches" for details.
\r
676 Fetch all tags from the remote (i.e., fetch remote tags
\r
677 <emphasis>refs/tags/*</emphasis> into local tags with the same name), in addition
\r
678 to whatever else would otherwise be fetched. Using this
\r
679 option alone does not subject tags to pruning, even if --prune
\r
680 is used (though tags may be pruned anyway if they are also the
\r
681 destination of an explicit refspec; see <emphasis>--prune</emphasis>).
\r
694 Number of parallel children to be used for all forms of fetching.
\r
696 <simpara>If the <emphasis>--multiple</emphasis> option was specified, the different remotes will be fetched
\r
697 in parallel. If multiple submodules are fetched, they will be fetched in
\r
698 parallel. To control them independently, use the config settings
\r
699 <emphasis>fetch.parallel</emphasis> and <emphasis>submodule.fetchJobs</emphasis> (see <xref linkend="git-config(1)" />).</simpara>
\r
700 <simpara>Typically, parallel recursive and multi-remote fetches will be faster. By
\r
701 default fetches are performed sequentially, not in parallel.</simpara>
\r
710 If the remote is fetched successfully, pull and add upstream
\r
711 (tracking) reference, used by argument-less
\r
712 <xref linkend="git-pull(1)" /> and other commands. For more information,
\r
713 see <emphasis>branch.<name>.merge</emphasis> and <emphasis>branch.<name>.remote</emphasis> in
\r
714 <xref linkend="git-config(1)" />.
\r
720 --upload-pack <upload-pack>
\r
724 When given, and the repository to fetch from is handled
\r
725 by <emphasis>git fetch-pack</emphasis>, <emphasis>--exec=<upload-pack></emphasis> is passed to
\r
726 the command to specify non-default path for the command
\r
727 run on the other end.
\r
737 Progress status is reported on the standard error stream
\r
738 by default when it is attached to a terminal, unless -q
\r
739 is specified. This flag forces progress status even if the
\r
740 standard error stream is not directed to a terminal.
\r
749 --server-option=<option>
\r
753 Transmit the given string to the server when communicating using
\r
754 protocol version 2. The given string must not contain a NUL or LF
\r
755 character. The server's handling of server options, including
\r
756 unknown ones, is server-specific.
\r
757 When multiple <emphasis>--server-option=<option></emphasis> are given, they are all
\r
758 sent to the other side in the order listed on the command line.
\r
764 --show-forced-updates
\r
768 By default, git checks if a branch is force-updated during
\r
769 fetch. This can be disabled through fetch.showForcedUpdates, but
\r
770 the --show-forced-updates option guarantees this check occurs.
\r
771 See <xref linkend="git-config(1)" />.
\r
777 --no-show-forced-updates
\r
781 By default, git checks if a branch is force-updated during
\r
782 fetch. Pass --no-show-forced-updates or set fetch.showForcedUpdates
\r
783 to false to skip this check for performance reasons. If used during
\r
784 <emphasis>git-pull</emphasis> the --ff-only option will still check for forced updates
\r
785 before attempting a fast-forward update. See <xref linkend="git-config(1)" />.
\r
798 Use IPv4 addresses only, ignoring IPv6 addresses.
\r
811 Use IPv6 addresses only, ignoring IPv4 addresses.
\r
821 The "remote" repository that is the source of a fetch
\r
822 or pull operation. This parameter can be either a URL
\r
823 (see the section <link linkend="git-pull(1)_URLS">GIT URLS</link> below) or the name
\r
824 of a remote (see the section <link linkend="git-pull(1)_REMOTES">REMOTES</link> below).
\r
834 Specifies which refs to fetch and which local refs to update.
\r
835 When no <refspec>s appear on the command line, the refs to fetch
\r
836 are read from <emphasis>remote.<repository>.fetch</emphasis> variables instead
\r
837 (see the section "CONFIGURED REMOTE-TRACKING BRANCHES"
\r
838 in <xref linkend="git-fetch(1)" />).
\r
840 <simpara>The format of a <refspec> parameter is an optional plus
\r
841 <emphasis>+</emphasis>, followed by the source <src>, followed
\r
842 by a colon <emphasis>:</emphasis>, followed by the destination ref <dst>.
\r
843 The colon can be omitted when <dst> is empty. <src> is
\r
844 typically a ref, but it can also be a fully spelled hex object
\r
846 <simpara><emphasis>tag <tag></emphasis> means the same as <emphasis>refs/tags/<tag>:refs/tags/<tag></emphasis>;
\r
847 it requests fetching everything up to the given tag.</simpara>
\r
848 <simpara>The remote ref that matches <src>
\r
849 is fetched, and if <dst> is not an empty string, an attempt
\r
850 is made to update the local ref that matches it.</simpara>
\r
851 <simpara>Whether that update is allowed without <emphasis>--force</emphasis> depends on the ref
\r
852 namespace it's being fetched to, the type of object being fetched, and
\r
853 whether the update is considered to be a fast-forward. Generally, the
\r
854 same rules apply for fetching as when pushing, see the <emphasis><refspec>...</emphasis>
\r
855 section of <xref linkend="git-push(1)" /> for what those are. Exceptions to those
\r
856 rules particular to <emphasis>git fetch</emphasis> are noted below.</simpara>
\r
857 <simpara>Until Git version 2.20, and unlike when pushing with
\r
858 <xref linkend="git-push(1)" />, any updates to <emphasis>refs/tags/*</emphasis> would be accepted
\r
859 without <emphasis>+</emphasis> in the refspec (or <emphasis>--force</emphasis>). When fetching, we promiscuously
\r
860 considered all tag updates from a remote to be forced fetches. Since
\r
861 Git version 2.20, fetching to update <emphasis>refs/tags/*</emphasis> works the same way
\r
862 as when pushing. I.e. any updates will be rejected without <emphasis>+</emphasis> in the
\r
863 refspec (or <emphasis>--force</emphasis>).</simpara>
\r
864 <simpara>Unlike when pushing with <xref linkend="git-push(1)" />, any updates outside of
\r
865 <emphasis>refs/{tags,heads}/*</emphasis> will be accepted without <emphasis>+</emphasis> in the refspec (or
\r
866 <emphasis>--force</emphasis>), whether that's swapping e.g. a tree object for a blob, or
\r
867 a commit for another commit that's doesn't have the previous commit as
\r
868 an ancestor etc.</simpara>
\r
869 <simpara>Unlike when pushing with <xref linkend="git-push(1)" />, there is no
\r
870 configuration which'll amend these rules, and nothing like a
\r
871 <emphasis>pre-fetch</emphasis> hook analogous to the <emphasis>pre-receive</emphasis> hook.</simpara>
\r
872 <simpara>As with pushing with <xref linkend="git-push(1)" />, all of the rules described
\r
873 above about what's not allowed as an update can be overridden by
\r
874 adding an the optional leading <emphasis>+</emphasis> to a refspec (or using <emphasis>--force</emphasis>
\r
875 command line option). The only exception to this is that no amount of
\r
876 forcing will make the <emphasis>refs/heads/*</emphasis> namespace accept a non-commit
\r
878 <note><simpara>When the remote branch you want to fetch is known to
\r
879 be rewound and rebased regularly, it is expected that
\r
880 its new tip will not be descendant of its previous tip
\r
881 (as stored in your remote-tracking branch the last time
\r
882 you fetched). You would want
\r
883 to use the <emphasis>+</emphasis> sign to indicate non-fast-forward updates
\r
884 will be needed for such branches. There is no way to
\r
885 determine or declare that a branch will be made available
\r
886 in a repository with this behavior; the pulling user simply
\r
887 must know this is the expected usage pattern for a branch.</simpara></note>
\r
888 <note><simpara>There is a difference between listing multiple <refspec>
\r
889 directly on <emphasis>git pull</emphasis> command line and having multiple
\r
890 <emphasis>remote.<repository>.fetch</emphasis> entries in your configuration
\r
891 for a <repository> and running a
\r
892 <emphasis>git pull</emphasis> command without any explicit <refspec> parameters.
\r
893 <refspec>s listed explicitly on the command line are always
\r
894 merged into the current branch after fetching. In other words,
\r
895 if you list more than one remote ref, <emphasis>git pull</emphasis> will create
\r
896 an Octopus merge. On the other hand, if you do not list any
\r
897 explicit <refspec> parameter on the command line, <emphasis>git pull</emphasis>
\r
898 will fetch all the <refspec>s it finds in the
\r
899 <emphasis>remote.<repository>.fetch</emphasis> configuration and merge
\r
900 only the first <refspec> found into the current branch.
\r
901 This is because making an
\r
902 Octopus from remote refs is rarely done, while keeping track
\r
903 of multiple remote heads in one-go by fetching more than one
\r
904 is often useful.</simpara></note>
\r
910 <simplesect id="git-pull(1)__git_urls_anchor_id_git_pull_1__urls_xreflabel_urls">
\r
911 <title>GIT URLS<anchor id="git-pull(1)_URLS" xreflabel="[URLS]"/></title>
\r
912 <simpara>In general, URLs contain information about the transport protocol, the
\r
913 address of the remote server, and the path to the repository.
\r
914 Depending on the transport protocol, some of this information may be
\r
916 <simpara>Git supports ssh, git, http, and https protocols (in addition, ftp,
\r
917 and ftps can be used for fetching, but this is inefficient and
\r
918 deprecated; do not use it).</simpara>
\r
919 <simpara>The native transport (i.e. git:// URL) does no authentication and
\r
920 should be used with caution on unsecured networks.</simpara>
\r
921 <simpara>The following syntaxes may be used with them:</simpara>
\r
925 ssh://[user@]host.xz[:port]/path/to/repo.git/
\r
930 git://host.xz[:port]/path/to/repo.git/
\r
935 http[s]://host.xz[:port]/path/to/repo.git/
\r
940 ftp[s]://host.xz[:port]/path/to/repo.git/
\r
944 <simpara>An alternative scp-like syntax may also be used with the ssh protocol:</simpara>
\r
948 [user@]host.xz:path/to/repo.git/
\r
952 <simpara>This syntax is only recognized if there are no slashes before the
\r
953 first colon. This helps differentiate a local path that contains a
\r
954 colon. For example the local path <emphasis>foo:bar</emphasis> could be specified as an
\r
955 absolute path or <emphasis>./foo:bar</emphasis> to avoid being misinterpreted as an ssh
\r
957 <simpara>The ssh and git protocols additionally support ~username expansion:</simpara>
\r
961 ssh://[user@]host.xz[:port]/~[user]/path/to/repo.git/
\r
966 git://host.xz[:port]/~[user]/path/to/repo.git/
\r
971 [user@]host.xz:/~[user]/path/to/repo.git/
\r
975 <simpara>For local repositories, also supported by Git natively, the following
\r
976 syntaxes may be used:</simpara>
\r
985 file:///path/to/repo.git/
\r
989 <simpara>These two syntaxes are mostly equivalent, except when cloning, when
\r
990 the former implies --local option. See <xref linkend="git-clone(1)" /> for
\r
992 <simpara><emphasis>git clone</emphasis>, <emphasis>git fetch</emphasis> and <emphasis>git pull</emphasis>, but not <emphasis>git push</emphasis>, will also
\r
993 accept a suitable bundle file. See <xref linkend="git-bundle(1)" />.</simpara>
\r
994 <simpara>When Git doesn't know how to handle a certain transport protocol, it
\r
995 attempts to use the <emphasis>remote-<transport></emphasis> remote helper, if one
\r
996 exists. To explicitly request a remote helper, the following syntax
\r
997 may be used:</simpara>
\r
1001 <transport>::<address>
\r
1005 <simpara>where <address> may be a path, a server and path, or an arbitrary
\r
1006 URL-like string recognized by the specific remote helper being
\r
1007 invoked. See <xref linkend="gitremote-helpers(7)" /> for details.</simpara>
\r
1008 <simpara>If there are a large number of similarly-named remote repositories and
\r
1009 you want to use a different format for them (such that the URLs you
\r
1010 use will be rewritten into URLs that work), you can create a
\r
1011 configuration section of the form:</simpara>
\r
1012 <screen> [url "<actual url base>"]
\r
1013 insteadOf = <other url base></screen>
\r
1014 <simpara>For example, with this:</simpara>
\r
1015 <screen> [url "git://git.host.xz/"]
\r
1016 insteadOf = host.xz:/path/to/
\r
1017 insteadOf = work:</screen>
\r
1018 <simpara>a URL like "work:repo.git" or like "host.xz:/path/to/repo.git" will be
\r
1019 rewritten in any context that takes a URL to be "git://git.host.xz/repo.git".</simpara>
\r
1020 <simpara>If you want to rewrite URLs for push only, you can create a
\r
1021 configuration section of the form:</simpara>
\r
1022 <screen> [url "<actual url base>"]
\r
1023 pushInsteadOf = <other url base></screen>
\r
1024 <simpara>For example, with this:</simpara>
\r
1025 <screen> [url "ssh://example.org/"]
\r
1026 pushInsteadOf = git://example.org/</screen>
\r
1027 <simpara>a URL like "git://example.org/path/to/repo.git" will be rewritten to
\r
1028 "ssh://example.org/path/to/repo.git" for pushes, but pulls will still
\r
1029 use the original URL.</simpara>
\r
1031 <simplesect id="git-pull(1)__remotes_anchor_id_git_pull_1__remotes_xreflabel_remotes">
\r
1032 <title>REMOTES<anchor id="git-pull(1)_REMOTES" xreflabel="[REMOTES]"/></title>
\r
1033 <simpara>The name of one of the following can be used instead
\r
1034 of a URL as <emphasis><repository></emphasis> argument:</simpara>
\r
1038 a remote in the Git configuration file: <emphasis>$GIT_DIR/config</emphasis>,
\r
1043 a file in the <emphasis>$GIT_DIR/remotes</emphasis> directory, or
\r
1048 a file in the <emphasis>$GIT_DIR/branches</emphasis> directory.
\r
1052 <simpara>All of these also allow you to omit the refspec from the command line
\r
1053 because they each contain a refspec which git will use by default.</simpara>
\r
1054 <section id="git-pull(1)__named_remote_in_configuration_file">
\r
1055 <title>Named remote in configuration file</title>
\r
1056 <simpara>You can choose to provide the name of a remote which you had previously
\r
1057 configured using <xref linkend="git-remote(1)" />, <xref linkend="git-config(1)" />
\r
1058 or even by a manual edit to the <emphasis>$GIT_DIR/config</emphasis> file. The URL of
\r
1059 this remote will be used to access the repository. The refspec
\r
1060 of this remote will be used by default when you do
\r
1061 not provide a refspec on the command line. The entry in the
\r
1062 config file would appear like this:</simpara>
\r
1063 <screen> [remote "<name>"]
\r
1065 pushurl = <pushurl>
\r
1066 push = <refspec>
\r
1067 fetch = <refspec></screen>
\r
1068 <simpara>The <emphasis><pushurl></emphasis> is used for pushes only. It is optional and defaults
\r
1069 to <emphasis><url></emphasis>.</simpara>
\r
1071 <section id="git-pull(1)__named_file_in_emphasis_git_dir_remotes_emphasis">
\r
1072 <title>Named file in <emphasis>$GIT_DIR/remotes</emphasis></title>
\r
1073 <simpara>You can choose to provide the name of a
\r
1074 file in <emphasis>$GIT_DIR/remotes</emphasis>. The URL
\r
1075 in this file will be used to access the repository. The refspec
\r
1076 in this file will be used as default when you do not
\r
1077 provide a refspec on the command line. This file should have the
\r
1078 following format:</simpara>
\r
1079 <screen> URL: one of the above URL format
\r
1080 Push: <refspec>
\r
1081 Pull: <refspec></screen>
\r
1082 <simpara><emphasis>Push:</emphasis> lines are used by <emphasis>git push</emphasis> and
\r
1083 <emphasis>Pull:</emphasis> lines are used by <emphasis>git pull</emphasis> and <emphasis>git fetch</emphasis>.
\r
1084 Multiple <emphasis>Push:</emphasis> and <emphasis>Pull:</emphasis> lines may
\r
1085 be specified for additional branch mappings.</simpara>
\r
1087 <section id="git-pull(1)__named_file_in_emphasis_git_dir_branches_emphasis">
\r
1088 <title>Named file in <emphasis>$GIT_DIR/branches</emphasis></title>
\r
1089 <simpara>You can choose to provide the name of a
\r
1090 file in <emphasis>$GIT_DIR/branches</emphasis>.
\r
1091 The URL in this file will be used to access the repository.
\r
1092 This file should have the following format:</simpara>
\r
1093 <screen> <url>#<head></screen>
\r
1094 <simpara><emphasis><url></emphasis> is required; <emphasis>#<head></emphasis> is optional.</simpara>
\r
1095 <simpara>Depending on the operation, git will use one of the following
\r
1096 refspecs, if you don't provide one on the command line.
\r
1097 <emphasis><branch></emphasis> is the name of this file in <emphasis>$GIT_DIR/branches</emphasis> and
\r
1098 <emphasis><head></emphasis> defaults to <emphasis>master</emphasis>.</simpara>
\r
1099 <simpara>git fetch uses:</simpara>
\r
1100 <screen> refs/heads/<head>:refs/heads/<branch></screen>
\r
1101 <simpara>git push uses:</simpara>
\r
1102 <screen> HEAD:refs/heads/<head></screen>
\r
1105 <simplesect id="git-pull(1)__merge_strategies">
\r
1106 <title>MERGE STRATEGIES</title>
\r
1107 <simpara>The merge mechanism (<emphasis>git merge</emphasis> and <emphasis>git pull</emphasis> commands) allows the
\r
1108 backend <emphasis>merge strategies</emphasis> to be chosen with <emphasis>-s</emphasis> option. Some strategies
\r
1109 can also take their own options, which can be passed by giving <emphasis>-X<option></emphasis>
\r
1110 arguments to <emphasis>git merge</emphasis> and/or <emphasis>git pull</emphasis>.</simpara>
\r
1118 This can only resolve two heads (i.e. the current branch
\r
1119 and another branch you pulled from) using a 3-way merge
\r
1120 algorithm. It tries to carefully detect criss-cross
\r
1121 merge ambiguities and is considered generally safe and
\r
1132 This can only resolve two heads using a 3-way merge
\r
1133 algorithm. When there is more than one common
\r
1134 ancestor that can be used for 3-way merge, it creates a
\r
1135 merged tree of the common ancestors and uses that as
\r
1136 the reference tree for the 3-way merge. This has been
\r
1137 reported to result in fewer merge conflicts without
\r
1138 causing mismerges by tests done on actual merge commits
\r
1139 taken from Linux 2.6 kernel development history.
\r
1140 Additionally this can detect and handle merges involving
\r
1141 renames, but currently cannot make use of detected
\r
1142 copies. This is the default merge strategy when pulling
\r
1143 or merging one branch.
\r
1145 <simpara>The <emphasis>recursive</emphasis> strategy can take the following options:</simpara>
\r
1153 This option forces conflicting hunks to be auto-resolved cleanly by
\r
1154 favoring <emphasis>our</emphasis> version. Changes from the other tree that do not
\r
1155 conflict with our side are reflected in the merge result.
\r
1156 For a binary file, the entire contents are taken from our side.
\r
1158 <simpara>This should not be confused with the <emphasis>ours</emphasis> merge strategy, which does not
\r
1159 even look at what the other tree contains at all. It discards everything
\r
1160 the other tree did, declaring <emphasis>our</emphasis> history contains all that happened in it.</simpara>
\r
1169 This is the opposite of <emphasis>ours</emphasis>; note that, unlike <emphasis>ours</emphasis>, there is
\r
1170 no <emphasis>theirs</emphasis> merge strategy to confuse this merge option with.
\r
1180 With this option, <emphasis>merge-recursive</emphasis> spends a little extra time
\r
1181 to avoid mismerges that sometimes occur due to unimportant
\r
1182 matching lines (e.g., braces from distinct functions). Use
\r
1183 this when the branches to be merged have diverged wildly.
\r
1184 See also <xref linkend="git-diff(1)" /> <emphasis>--patience</emphasis>.
\r
1190 diff-algorithm=[patience|minimal|histogram|myers]
\r
1194 Tells <emphasis>merge-recursive</emphasis> to use a different diff algorithm, which
\r
1195 can help avoid mismerges that occur due to unimportant matching
\r
1196 lines (such as braces from distinct functions). See also
\r
1197 <xref linkend="git-diff(1)" /> <emphasis>--diff-algorithm</emphasis>.
\r
1203 ignore-space-change
\r
1209 ignore-space-at-eol
\r
1216 Treats lines with the indicated type of whitespace change as
\r
1217 unchanged for the sake of a three-way merge. Whitespace
\r
1218 changes mixed with other changes to a line are not ignored.
\r
1219 See also <xref linkend="git-diff(1)" /> <emphasis>-b</emphasis>, <emphasis>-w</emphasis>,
\r
1220 <emphasis>--ignore-space-at-eol</emphasis>, and <emphasis>--ignore-cr-at-eol</emphasis>.
\r
1225 If <emphasis>their</emphasis> version only introduces whitespace changes to a line,
\r
1226 <emphasis>our</emphasis> version is used;
\r
1231 If <emphasis>our</emphasis> version introduces whitespace changes but <emphasis>their</emphasis>
\r
1232 version includes a substantial change, <emphasis>their</emphasis> version is used;
\r
1237 Otherwise, the merge proceeds in the usual way.
\r
1249 This runs a virtual check-out and check-in of all three stages
\r
1250 of a file when resolving a three-way merge. This option is
\r
1251 meant to be used when merging branches with different clean
\r
1252 filters or end-of-line normalization rules. See "Merging
\r
1253 branches with differing checkin/checkout attributes" in
\r
1254 <xref linkend="gitattributes(5)" /> for details.
\r
1264 Disables the <emphasis>renormalize</emphasis> option. This overrides the
\r
1265 <emphasis>merge.renormalize</emphasis> configuration variable.
\r
1275 Turn off rename detection. This overrides the <emphasis>merge.renames</emphasis>
\r
1276 configuration variable.
\r
1277 See also <xref linkend="git-diff(1)" /> <emphasis>--no-renames</emphasis>.
\r
1283 find-renames[=<n>]
\r
1287 Turn on rename detection, optionally setting the similarity
\r
1288 threshold. This is the default. This overrides the
\r
1289 <emphasis>merge.renames</emphasis> configuration variable.
\r
1290 See also <xref linkend="git-diff(1)" /> <emphasis>--find-renames</emphasis>.
\r
1296 rename-threshold=<n>
\r
1300 Deprecated synonym for <emphasis>find-renames=<n></emphasis>.
\r
1306 subtree[=<path>]
\r
1310 This option is a more advanced form of <emphasis>subtree</emphasis> strategy, where
\r
1311 the strategy makes a guess on how two trees must be shifted to
\r
1312 match with each other when merging. Instead, the specified path
\r
1313 is prefixed (or stripped from the beginning) to make the shape of
\r
1314 two trees to match.
\r
1327 This resolves cases with more than two heads, but refuses to do
\r
1328 a complex merge that needs manual resolution. It is
\r
1329 primarily meant to be used for bundling topic branch
\r
1330 heads together. This is the default merge strategy when
\r
1331 pulling or merging more than one branch.
\r
1341 This resolves any number of heads, but the resulting tree of the
\r
1342 merge is always that of the current branch head, effectively
\r
1343 ignoring all changes from all other branches. It is meant to
\r
1344 be used to supersede old development history of side
\r
1345 branches. Note that this is different from the -Xours option to
\r
1346 the <emphasis>recursive</emphasis> merge strategy.
\r
1356 This is a modified recursive strategy. When merging trees A and
\r
1357 B, if B corresponds to a subtree of A, B is first adjusted to
\r
1358 match the tree structure of A, instead of reading the trees at
\r
1359 the same level. This adjustment is also done to the common
\r
1365 <simpara>With the strategies that use 3-way merge (including the default, <emphasis>recursive</emphasis>),
\r
1366 if a change is made on both branches, but later reverted on one of the
\r
1367 branches, that change will be present in the merged result; some people find
\r
1368 this behavior confusing. It occurs because only the heads and the merge base
\r
1369 are considered when performing a merge, not the individual commits. The merge
\r
1370 algorithm therefore considers the reverted change as no change at all, and
\r
1371 substitutes the changed version instead.</simpara>
\r
1373 <simplesect id="git-pull(1)__default_behaviour">
\r
1374 <title>DEFAULT BEHAVIOUR</title>
\r
1375 <simpara>Often people use <emphasis>git pull</emphasis> without giving any parameter.
\r
1376 Traditionally, this has been equivalent to saying <emphasis>git pull
\r
1377 origin</emphasis>. However, when configuration <emphasis>branch.<name>.remote</emphasis> is
\r
1378 present while on branch <emphasis><name></emphasis>, that value is used instead of
\r
1379 <emphasis>origin</emphasis>.</simpara>
\r
1380 <simpara>In order to determine what URL to use to fetch from, the value
\r
1381 of the configuration <emphasis>remote.<origin>.url</emphasis> is consulted
\r
1382 and if there is not any such variable, the value on the <emphasis>URL:</emphasis> line
\r
1383 in <emphasis>$GIT_DIR/remotes/<origin></emphasis> is used.</simpara>
\r
1384 <simpara>In order to determine what remote branches to fetch (and
\r
1385 optionally store in the remote-tracking branches) when the command is
\r
1386 run without any refspec parameters on the command line, values
\r
1387 of the configuration variable <emphasis>remote.<origin>.fetch</emphasis> are
\r
1388 consulted, and if there aren't any, <emphasis>$GIT_DIR/remotes/<origin></emphasis>
\r
1389 is consulted and its <emphasis>Pull:</emphasis> lines are used.
\r
1390 In addition to the refspec formats described in the OPTIONS
\r
1391 section, you can have a globbing refspec that looks like this:</simpara>
\r
1392 <screen>refs/heads/*:refs/remotes/origin/*</screen>
\r
1393 <simpara>A globbing refspec must have a non-empty RHS (i.e. must store
\r
1394 what were fetched in remote-tracking branches), and its LHS and RHS
\r
1395 must end with <emphasis>/*</emphasis>. The above specifies that all remote
\r
1396 branches are tracked using remote-tracking branches in
\r
1397 <emphasis>refs/remotes/origin/</emphasis> hierarchy under the same name.</simpara>
\r
1398 <simpara>The rule to determine which remote branch to merge after
\r
1399 fetching is a bit involved, in order not to break backward
\r
1400 compatibility.</simpara>
\r
1401 <simpara>If explicit refspecs were given on the command
\r
1402 line of <emphasis>git pull</emphasis>, they are all merged.</simpara>
\r
1403 <simpara>When no refspec was given on the command line, then <emphasis>git pull</emphasis>
\r
1404 uses the refspec from the configuration or
\r
1405 <emphasis>$GIT_DIR/remotes/<origin></emphasis>. In such cases, the following
\r
1406 rules apply:</simpara>
\r
1407 <orderedlist numeration="arabic">
\r
1410 If <emphasis>branch.<name>.merge</emphasis> configuration for the current
\r
1411 branch <emphasis><name></emphasis> exists, that is the name of the branch at the
\r
1412 remote site that is merged.
\r
1417 If the refspec is a globbing one, nothing is merged.
\r
1422 Otherwise the remote branch of the first refspec is merged.
\r
1427 <simplesect id="git-pull(1)__examples">
\r
1428 <title>EXAMPLES</title>
\r
1432 Update the remote-tracking branches for the repository
\r
1433 you cloned from, then merge one of them into your
\r
1436 <screen>$ git pull
\r
1437 $ git pull origin</screen>
\r
1438 <simpara>Normally the branch merged in is the HEAD of the remote repository,
\r
1439 but the choice is determined by the branch.<name>.remote and
\r
1440 branch.<name>.merge options; see <xref linkend="git-config(1)" /> for details.</simpara>
\r
1444 Merge into the current branch the remote branch <emphasis>next</emphasis>:
\r
1446 <screen>$ git pull origin next</screen>
\r
1447 <simpara>This leaves a copy of <emphasis>next</emphasis> temporarily in FETCH_HEAD, and
\r
1448 updates the remote-tracking branch <emphasis>origin/next</emphasis>.
\r
1449 The same can be done by invoking fetch and merge:</simpara>
\r
1450 <screen>$ git fetch origin
\r
1451 $ git merge origin/next</screen>
\r
1454 <simpara>If you tried a pull which resulted in complex conflicts and
\r
1455 would want to start over, you can recover with <emphasis>git reset</emphasis>.</simpara>
\r
1457 <simplesect id="git-pull(1)__security">
\r
1458 <title>SECURITY</title>
\r
1459 <simpara>The fetch and push protocols are not designed to prevent one side from
\r
1460 stealing data from the other repository that was not intended to be
\r
1461 shared. If you have private data that you need to protect from a malicious
\r
1462 peer, your best option is to store it in another repository. This applies
\r
1463 to both clients and servers. In particular, namespaces on a server are not
\r
1464 effective for read access control; you should only grant read access to a
\r
1465 namespace to clients that you would trust with read access to the entire
\r
1466 repository.</simpara>
\r
1467 <simpara>The known attack vectors are as follows:</simpara>
\r
1468 <orderedlist numeration="arabic">
\r
1471 The victim sends "have" lines advertising the IDs of objects it has that
\r
1472 are not explicitly intended to be shared but can be used to optimize the
\r
1473 transfer if the peer also has them. The attacker chooses an object ID X
\r
1474 to steal and sends a ref to X, but isn't required to send the content of
\r
1475 X because the victim already has it. Now the victim believes that the
\r
1476 attacker has X, and it sends the content of X back to the attacker
\r
1477 later. (This attack is most straightforward for a client to perform on a
\r
1478 server, by creating a ref to X in the namespace the client has access
\r
1479 to and then fetching it. The most likely way for a server to perform it
\r
1480 on a client is to "merge" X into a public branch and hope that the user
\r
1481 does additional work on this branch and pushes it back to the server
\r
1482 without noticing the merge.)
\r
1487 As in #1, the attacker chooses an object ID X to steal. The victim sends
\r
1488 an object Y that the attacker already has, and the attacker falsely
\r
1489 claims to have X and not Y, so the victim sends Y as a delta against X.
\r
1490 The delta reveals regions of X that are similar to Y to the attacker.
\r
1495 <simplesect id="git-pull(1)__bugs">
\r
1496 <title>BUGS</title>
\r
1497 <simpara>Using --recurse-submodules can only fetch new commits in already checked
\r
1498 out submodules right now. When e.g. upstream added a new submodule in the
\r
1499 just fetched commits of the superproject the submodule itself cannot be
\r
1500 fetched, making it impossible to check out that submodule later without
\r
1501 having to do a fetch again. This is expected to be fixed in a future Git
\r
1502 version.</simpara>
\r
1504 <simplesect id="git-pull(1)__see_also">
\r
1505 <title>SEE ALSO</title>
\r
1506 <simpara><xref linkend="git-fetch(1)" />, <xref linkend="git-merge(1)" />, <xref linkend="git-config(1)" /></simpara>
\r
1508 <simplesect id="git-pull(1)__git">
\r
1509 <title>GIT</title>
\r
1510 <simpara>Part of the <xref linkend="git(1)" /> suite</simpara>
\r