1GIT-PULL(1)                       Git Manual                       GIT-PULL(1)
2
3
4

NAME

6       git-pull - Fetch from and integrate with another repository or a local
7       branch
8

SYNOPSIS

10       git pull [<options>] [<repository> [<refspec>...]]
11

DESCRIPTION

13       Incorporates changes from a remote repository into the current branch.
14       In its default mode, git pull is shorthand for git fetch followed by
15       git merge FETCH_HEAD.
16
17       More precisely, git pull runs git fetch with the given parameters and
18       calls git merge to merge the retrieved branch heads into the current
19       branch. With --rebase, it runs git rebase instead of git merge.
20
21       <repository> should be the name of a remote repository as passed to
22       git-fetch(1). <refspec> can name an arbitrary remote ref (for example,
23       the name of a tag) or even a collection of refs with corresponding
24       remote-tracking branches (e.g., refs/heads/*:refs/remotes/origin/*),
25       but usually it is the name of a branch in the remote repository.
26
27       Default values for <repository> and <branch> are read from the "remote"
28       and "merge" configuration for the current branch as set by git-
29       branch(1) --track.
30
31       Assume the following history exists and the current branch is "master":
32
33                     A---B---C master on origin
34                    /
35               D---E---F---G master
36                   ^
37                   origin/master in your repository
38
39       Then "git pull" will fetch and replay the changes from the remote
40       master branch since it diverged from the local master (i.e., E) until
41       its current commit (C) on top of master and record the result in a new
42       commit along with the names of the two parent commits and a log message
43       from the user describing the changes.
44
45                     A---B---C origin/master
46                    /         \
47               D---E---F---G---H master
48
49       See git-merge(1) for details, including how conflicts are presented and
50       handled.
51
52       In Git 1.7.0 or later, to cancel a conflicting merge, use git reset
53       --merge. Warning: In older versions of Git, running git pull with
54       uncommitted changes is discouraged: while possible, it leaves you in a
55       state that may be hard to back out of in the case of a conflict.
56
57       If any of the remote changes overlap with local uncommitted changes,
58       the merge will be automatically canceled and the work tree untouched.
59       It is generally best to get any local changes in working order before
60       pulling or stash them away with git-stash(1).
61

OPTIONS

63       -q, --quiet
64           This is passed to both underlying git-fetch to squelch reporting of
65           during transfer, and underlying git-merge to squelch output during
66           merging.
67
68       -v, --verbose
69           Pass --verbose to git-fetch and git-merge.
70
71       --[no-]recurse-submodules[=yes|on-demand|no]
72           This option controls if new commits of populated submodules should
73           be fetched, and if the working trees of active submodules should be
74           updated, too (see git-fetch(1), git-config(1) and gitmodules(5)).
75
76           If the checkout is done via rebase, local submodule commits are
77           rebased as well.
78
79           If the update is done via merge, the submodule conflicts are
80           resolved and checked out.
81
82   Options related to merging
83       --commit, --no-commit
84           Perform the merge and commit the result. This option can be used to
85           override --no-commit.
86
87           With --no-commit perform the merge and stop just before creating a
88           merge commit, to give the user a chance to inspect and further
89           tweak the merge result before committing.
90
91           Note that fast-forward updates do not create a merge commit and
92           therefore there is no way to stop those merges with --no-commit.
93           Thus, if you want to ensure your branch is not changed or updated
94           by the merge command, use --no-ff with --no-commit.
95
96       --edit, -e, --no-edit
97           Invoke an editor before committing successful mechanical merge to
98           further edit the auto-generated merge message, so that the user can
99           explain and justify the merge. The --no-edit option can be used to
100           accept the auto-generated message (this is generally discouraged).
101
102           Older scripts may depend on the historical behaviour of not
103           allowing the user to edit the merge log message. They will see an
104           editor opened when they run git merge. To make it easier to adjust
105           such scripts to the updated behaviour, the environment variable
106           GIT_MERGE_AUTOEDIT can be set to no at the beginning of them.
107
108       --cleanup=<mode>
109           This option determines how the merge message will be cleaned up
110           before committing. See git-commit(1) for more details. In addition,
111           if the <mode> is given a value of scissors, scissors will be
112           appended to MERGE_MSG before being passed on to the commit
113           machinery in the case of a merge conflict.
114
115       --ff, --no-ff, --ff-only
116           Specifies how a merge is handled when the merged-in history is
117           already a descendant of the current history.  --ff is the default
118           unless merging an annotated (and possibly signed) tag that is not
119           stored in its natural place in the refs/tags/ hierarchy, in which
120           case --no-ff is assumed.
121
122           With --ff, when possible resolve the merge as a fast-forward (only
123           update the branch pointer to match the merged branch; do not create
124           a merge commit). When not possible (when the merged-in history is
125           not a descendant of the current history), create a merge commit.
126
127           With --no-ff, create a merge commit in all cases, even when the
128           merge could instead be resolved as a fast-forward.
129
130           With --ff-only, resolve the merge as a fast-forward when possible.
131           When not possible, refuse to merge and exit with a non-zero status.
132
133       -S[<keyid>], --gpg-sign[=<keyid>], --no-gpg-sign
134           GPG-sign the resulting merge commit. The keyid argument is optional
135           and defaults to the committer identity; if specified, it must be
136           stuck to the option without a space.  --no-gpg-sign is useful to
137           countermand both commit.gpgSign configuration variable, and earlier
138           --gpg-sign.
139
140       --log[=<n>], --no-log
141           In addition to branch names, populate the log message with one-line
142           descriptions from at most <n> actual commits that are being merged.
143           See also git-fmt-merge-msg(1).
144
145           With --no-log do not list one-line descriptions from the actual
146           commits being merged.
147
148       --signoff, --no-signoff
149           Add a Signed-off-by trailer by the committer at the end of the
150           commit log message. The meaning of a signoff depends on the project
151           to which you’re committing. For example, it may certify that the
152           committer has the rights to submit the work under the project’s
153           license or agrees to some contributor representation, such as a
154           Developer Certificate of Origin. (See
155           http://developercertificate.org for the one used by the Linux
156           kernel and Git projects.) Consult the documentation or leadership
157           of the project to which you’re contributing to understand how the
158           signoffs are used in that project.
159
160           The --no-signoff option can be used to countermand an earlier
161           --signoff option on the command line.
162
163       --stat, -n, --no-stat
164           Show a diffstat at the end of the merge. The diffstat is also
165           controlled by the configuration option merge.stat.
166
167           With -n or --no-stat do not show a diffstat at the end of the
168           merge.
169
170       --squash, --no-squash
171           Produce the working tree and index state as if a real merge
172           happened (except for the merge information), but do not actually
173           make a commit, move the HEAD, or record $GIT_DIR/MERGE_HEAD (to
174           cause the next git commit command to create a merge commit). This
175           allows you to create a single commit on top of the current branch
176           whose effect is the same as merging another branch (or more in case
177           of an octopus).
178
179           With --no-squash perform the merge and commit the result. This
180           option can be used to override --squash.
181
182           With --squash, --commit is not allowed, and will fail.
183
184       --no-verify
185           This option bypasses the pre-merge and commit-msg hooks. See also
186           githooks(5).
187
188       -s <strategy>, --strategy=<strategy>
189           Use the given merge strategy; can be supplied more than once to
190           specify them in the order they should be tried. If there is no -s
191           option, a built-in list of strategies is used instead (git
192           merge-recursive when merging a single head, git merge-octopus
193           otherwise).
194
195       -X <option>, --strategy-option=<option>
196           Pass merge strategy specific option through to the merge strategy.
197
198       --verify-signatures, --no-verify-signatures
199           Verify that the tip commit of the side branch being merged is
200           signed with a valid key, i.e. a key that has a valid uid: in the
201           default trust model, this means the signing key has been signed by
202           a trusted key. If the tip commit of the side branch is not signed
203           with a valid key, the merge is aborted.
204
205       --summary, --no-summary
206           Synonyms to --stat and --no-stat; these are deprecated and will be
207           removed in the future.
208
209       --autostash, --no-autostash
210           Automatically create a temporary stash entry before the operation
211           begins, and apply it after the operation ends. This means that you
212           can run the operation on a dirty worktree. However, use with care:
213           the final stash application after a successful merge might result
214           in non-trivial conflicts.
215
216       --allow-unrelated-histories
217           By default, git merge command refuses to merge histories that do
218           not share a common ancestor. This option can be used to override
219           this safety when merging histories of two projects that started
220           their lives independently. As that is a very rare occasion, no
221           configuration variable to enable this by default exists and will
222           not be added.
223
224       -r, --rebase[=false|true|merges|preserve|interactive]
225           When true, rebase the current branch on top of the upstream branch
226           after fetching. If there is a remote-tracking branch corresponding
227           to the upstream branch and the upstream branch was rebased since
228           last fetched, the rebase uses that information to avoid rebasing
229           non-local changes.
230
231           When set to merges, rebase using git rebase --rebase-merges so that
232           the local merge commits are included in the rebase (see git-
233           rebase(1) for details).
234
235           When set to preserve (deprecated in favor of merges), rebase with
236           the --preserve-merges option passed to git rebase so that locally
237           created merge commits will not be flattened.
238
239           When false, merge the current branch into the upstream branch.
240
241           When interactive, enable the interactive mode of rebase.
242
243           See pull.rebase, branch.<name>.rebase and branch.autoSetupRebase in
244           git-config(1) if you want to make git pull always use --rebase
245           instead of merging.
246
247               Note
248               This is a potentially dangerous mode of operation. It rewrites
249               history, which does not bode well when you published that
250               history already. Do not use this option unless you have read
251               git-rebase(1) carefully.
252
253       --no-rebase
254           Override earlier --rebase.
255
256   Options related to fetching
257       --all
258           Fetch all remotes.
259
260       -a, --append
261           Append ref names and object names of fetched refs to the existing
262           contents of .git/FETCH_HEAD. Without this option old data in
263           .git/FETCH_HEAD will be overwritten.
264
265       --atomic
266           Use an atomic transaction to update local refs. Either all refs are
267           updated, or on error, no refs are updated.
268
269       --depth=<depth>
270           Limit fetching to the specified number of commits from the tip of
271           each remote branch history. If fetching to a shallow repository
272           created by git clone with --depth=<depth> option (see git-
273           clone(1)), deepen or shorten the history to the specified number of
274           commits. Tags for the deepened commits are not fetched.
275
276       --deepen=<depth>
277           Similar to --depth, except it specifies the number of commits from
278           the current shallow boundary instead of from the tip of each remote
279           branch history.
280
281       --shallow-since=<date>
282           Deepen or shorten the history of a shallow repository to include
283           all reachable commits after <date>.
284
285       --shallow-exclude=<revision>
286           Deepen or shorten the history of a shallow repository to exclude
287           commits reachable from a specified remote branch or tag. This
288           option can be specified multiple times.
289
290       --unshallow
291           If the source repository is complete, convert a shallow repository
292           to a complete one, removing all the limitations imposed by shallow
293           repositories.
294
295           If the source repository is shallow, fetch as much as possible so
296           that the current repository has the same history as the source
297           repository.
298
299       --update-shallow
300           By default when fetching from a shallow repository, git fetch
301           refuses refs that require updating .git/shallow. This option
302           updates .git/shallow and accept such refs.
303
304       --negotiation-tip=<commit|glob>
305           By default, Git will report, to the server, commits reachable from
306           all local refs to find common commits in an attempt to reduce the
307           size of the to-be-received packfile. If specified, Git will only
308           report commits reachable from the given tips. This is useful to
309           speed up fetches when the user knows which local ref is likely to
310           have commits in common with the upstream ref being fetched.
311
312           This option may be specified more than once; if so, Git will report
313           commits reachable from any of the given commits.
314
315           The argument to this option may be a glob on ref names, a ref, or
316           the (possibly abbreviated) SHA-1 of a commit. Specifying a glob is
317           equivalent to specifying this option multiple times, one for each
318           matching ref name.
319
320           See also the fetch.negotiationAlgorithm configuration variable
321           documented in git-config(1).
322
323       --dry-run
324           Show what would be done, without making any changes.
325
326       -f, --force
327           When git fetch is used with <src>:<dst> refspec it may refuse to
328           update the local branch as discussed in the <refspec> part of the
329           git-fetch(1) documentation. This option overrides that check.
330
331       -k, --keep
332           Keep downloaded pack.
333
334       -p, --prune
335           Before fetching, remove any remote-tracking references that no
336           longer exist on the remote. Tags are not subject to pruning if they
337           are fetched only because of the default tag auto-following or due
338           to a --tags option. However, if tags are fetched due to an explicit
339           refspec (either on the command line or in the remote configuration,
340           for example if the remote was cloned with the --mirror option),
341           then they are also subject to pruning. Supplying --prune-tags is a
342           shorthand for providing the tag refspec.
343
344       --no-tags
345           By default, tags that point at objects that are downloaded from the
346           remote repository are fetched and stored locally. This option
347           disables this automatic tag following. The default behavior for a
348           remote may be specified with the remote.<name>.tagOpt setting. See
349           git-config(1).
350
351       --refmap=<refspec>
352           When fetching refs listed on the command line, use the specified
353           refspec (can be given more than once) to map the refs to
354           remote-tracking branches, instead of the values of remote.*.fetch
355           configuration variables for the remote repository. Providing an
356           empty <refspec> to the --refmap option causes Git to ignore the
357           configured refspecs and rely entirely on the refspecs supplied as
358           command-line arguments. See section on "Configured Remote-tracking
359           Branches" for details.
360
361       -t, --tags
362           Fetch all tags from the remote (i.e., fetch remote tags refs/tags/*
363           into local tags with the same name), in addition to whatever else
364           would otherwise be fetched. Using this option alone does not
365           subject tags to pruning, even if --prune is used (though tags may
366           be pruned anyway if they are also the destination of an explicit
367           refspec; see --prune).
368
369       -j, --jobs=<n>
370           Number of parallel children to be used for all forms of fetching.
371
372           If the --multiple option was specified, the different remotes will
373           be fetched in parallel. If multiple submodules are fetched, they
374           will be fetched in parallel. To control them independently, use the
375           config settings fetch.parallel and submodule.fetchJobs (see git-
376           config(1)).
377
378           Typically, parallel recursive and multi-remote fetches will be
379           faster. By default fetches are performed sequentially, not in
380           parallel.
381
382       --set-upstream
383           If the remote is fetched successfully, add upstream (tracking)
384           reference, used by argument-less git-pull(1) and other commands.
385           For more information, see branch.<name>.merge and
386           branch.<name>.remote in git-config(1).
387
388       --upload-pack <upload-pack>
389           When given, and the repository to fetch from is handled by git
390           fetch-pack, --exec=<upload-pack> is passed to the command to
391           specify non-default path for the command run on the other end.
392
393       --progress
394           Progress status is reported on the standard error stream by default
395           when it is attached to a terminal, unless -q is specified. This
396           flag forces progress status even if the standard error stream is
397           not directed to a terminal.
398
399       -o <option>, --server-option=<option>
400           Transmit the given string to the server when communicating using
401           protocol version 2. The given string must not contain a NUL or LF
402           character. The server’s handling of server options, including
403           unknown ones, is server-specific. When multiple
404           --server-option=<option> are given, they are all sent to the other
405           side in the order listed on the command line.
406
407       --show-forced-updates
408           By default, git checks if a branch is force-updated during fetch.
409           This can be disabled through fetch.showForcedUpdates, but the
410           --show-forced-updates option guarantees this check occurs. See git-
411           config(1).
412
413       --no-show-forced-updates
414           By default, git checks if a branch is force-updated during fetch.
415           Pass --no-show-forced-updates or set fetch.showForcedUpdates to
416           false to skip this check for performance reasons. If used during
417           git-pull the --ff-only option will still check for forced updates
418           before attempting a fast-forward update. See git-config(1).
419
420       -4, --ipv4
421           Use IPv4 addresses only, ignoring IPv6 addresses.
422
423       -6, --ipv6
424           Use IPv6 addresses only, ignoring IPv4 addresses.
425
426       <repository>
427           The "remote" repository that is the source of a fetch or pull
428           operation. This parameter can be either a URL (see the section GIT
429           URLS below) or the name of a remote (see the section REMOTES
430           below).
431
432       <refspec>
433           Specifies which refs to fetch and which local refs to update. When
434           no <refspec>s appear on the command line, the refs to fetch are
435           read from remote.<repository>.fetch variables instead (see the
436           section "CONFIGURED REMOTE-TRACKING BRANCHES" in git-fetch(1)).
437
438           The format of a <refspec> parameter is an optional plus +, followed
439           by the source <src>, followed by a colon :, followed by the
440           destination ref <dst>. The colon can be omitted when <dst> is
441           empty. <src> is typically a ref, but it can also be a fully spelled
442           hex object name.
443
444           A <refspec> may contain a * in its <src> to indicate a simple
445           pattern match. Such a refspec functions like a glob that matches
446           any ref with the same prefix. A pattern <refspec> must have a * in
447           both the <src> and <dst>. It will map refs to the destination by
448           replacing the * with the contents matched from the source.
449
450           If a refspec is prefixed by ^, it will be interpreted as a negative
451           refspec. Rather than specifying which refs to fetch or which local
452           refs to update, such a refspec will instead specify refs to
453           exclude. A ref will be considered to match if it matches at least
454           one positive refspec, and does not match any negative refspec.
455           Negative refspecs can be useful to restrict the scope of a pattern
456           refspec so that it will not include specific refs. Negative
457           refspecs can themselves be pattern refspecs. However, they may only
458           contain a <src> and do not specify a <dst>. Fully spelled out hex
459           object names are also not supported.
460
461           tag <tag> means the same as refs/tags/<tag>:refs/tags/<tag>; it
462           requests fetching everything up to the given tag.
463
464           The remote ref that matches <src> is fetched, and if <dst> is not
465           an empty string, an attempt is made to update the local ref that
466           matches it.
467
468           Whether that update is allowed without --force depends on the ref
469           namespace it’s being fetched to, the type of object being fetched,
470           and whether the update is considered to be a fast-forward.
471           Generally, the same rules apply for fetching as when pushing, see
472           the <refspec>...  section of git-push(1) for what those are.
473           Exceptions to those rules particular to git fetch are noted below.
474
475           Until Git version 2.20, and unlike when pushing with git-push(1),
476           any updates to refs/tags/* would be accepted without + in the
477           refspec (or --force). When fetching, we promiscuously considered
478           all tag updates from a remote to be forced fetches. Since Git
479           version 2.20, fetching to update refs/tags/* works the same way as
480           when pushing. I.e. any updates will be rejected without + in the
481           refspec (or --force).
482
483           Unlike when pushing with git-push(1), any updates outside of
484           refs/{tags,heads}/* will be accepted without + in the refspec (or
485           --force), whether that’s swapping e.g. a tree object for a blob, or
486           a commit for another commit that’s doesn’t have the previous commit
487           as an ancestor etc.
488
489           Unlike when pushing with git-push(1), there is no configuration
490           which’ll amend these rules, and nothing like a pre-fetch hook
491           analogous to the pre-receive hook.
492
493           As with pushing with git-push(1), all of the rules described above
494           about what’s not allowed as an update can be overridden by adding
495           an the optional leading + to a refspec (or using --force command
496           line option). The only exception to this is that no amount of
497           forcing will make the refs/heads/* namespace accept a non-commit
498           object.
499
500               Note
501               When the remote branch you want to fetch is known to be rewound
502               and rebased regularly, it is expected that its new tip will not
503               be descendant of its previous tip (as stored in your
504               remote-tracking branch the last time you fetched). You would
505               want to use the + sign to indicate non-fast-forward updates
506               will be needed for such branches. There is no way to determine
507               or declare that a branch will be made available in a repository
508               with this behavior; the pulling user simply must know this is
509               the expected usage pattern for a branch.
510
511               Note
512               There is a difference between listing multiple <refspec>
513               directly on git pull command line and having multiple
514               remote.<repository>.fetch entries in your configuration for a
515               <repository> and running a git pull command without any
516               explicit <refspec> parameters. <refspec>s listed explicitly on
517               the command line are always merged into the current branch
518               after fetching. In other words, if you list more than one
519               remote ref, git pull will create an Octopus merge. On the other
520               hand, if you do not list any explicit <refspec> parameter on
521               the command line, git pull will fetch all the <refspec>s it
522               finds in the remote.<repository>.fetch configuration and merge
523               only the first <refspec> found into the current branch. This is
524               because making an Octopus from remote refs is rarely done,
525               while keeping track of multiple remote heads in one-go by
526               fetching more than one is often useful.
527

GIT URLS

529       In general, URLs contain information about the transport protocol, the
530       address of the remote server, and the path to the repository. Depending
531       on the transport protocol, some of this information may be absent.
532
533       Git supports ssh, git, http, and https protocols (in addition, ftp, and
534       ftps can be used for fetching, but this is inefficient and deprecated;
535       do not use it).
536
537       The native transport (i.e. git:// URL) does no authentication and
538       should be used with caution on unsecured networks.
539
540       The following syntaxes may be used with them:
541
542       •   ssh://[user@]host.xz[:port]/path/to/repo.git/
543
544       •   git://host.xz[:port]/path/to/repo.git/
545
546       •   http[s]://host.xz[:port]/path/to/repo.git/
547
548       •   ftp[s]://host.xz[:port]/path/to/repo.git/
549
550       An alternative scp-like syntax may also be used with the ssh protocol:
551
552       •   [user@]host.xz:path/to/repo.git/
553
554       This syntax is only recognized if there are no slashes before the first
555       colon. This helps differentiate a local path that contains a colon. For
556       example the local path foo:bar could be specified as an absolute path
557       or ./foo:bar to avoid being misinterpreted as an ssh url.
558
559       The ssh and git protocols additionally support ~username expansion:
560
561       •   ssh://[user@]host.xz[:port]/~[user]/path/to/repo.git/
562
563       •   git://host.xz[:port]/~[user]/path/to/repo.git/
564
565       •   [user@]host.xz:/~[user]/path/to/repo.git/
566
567       For local repositories, also supported by Git natively, the following
568       syntaxes may be used:
569
570       •   /path/to/repo.git/
571
572       •   file:///path/to/repo.git/
573
574       These two syntaxes are mostly equivalent, except when cloning, when the
575       former implies --local option. See git-clone(1) for details.
576
577       git clone, git fetch and git pull, but not git push, will also accept a
578       suitable bundle file. See git-bundle(1).
579
580       When Git doesn’t know how to handle a certain transport protocol, it
581       attempts to use the remote-<transport> remote helper, if one exists. To
582       explicitly request a remote helper, the following syntax may be used:
583
584       •   <transport>::<address>
585
586       where <address> may be a path, a server and path, or an arbitrary
587       URL-like string recognized by the specific remote helper being invoked.
588       See gitremote-helpers(7) for details.
589
590       If there are a large number of similarly-named remote repositories and
591       you want to use a different format for them (such that the URLs you use
592       will be rewritten into URLs that work), you can create a configuration
593       section of the form:
594
595                   [url "<actual url base>"]
596                           insteadOf = <other url base>
597
598       For example, with this:
599
600                   [url "git://git.host.xz/"]
601                           insteadOf = host.xz:/path/to/
602                           insteadOf = work:
603
604       a URL like "work:repo.git" or like "host.xz:/path/to/repo.git" will be
605       rewritten in any context that takes a URL to be
606       "git://git.host.xz/repo.git".
607
608       If you want to rewrite URLs for push only, you can create a
609       configuration section of the form:
610
611                   [url "<actual url base>"]
612                           pushInsteadOf = <other url base>
613
614       For example, with this:
615
616                   [url "ssh://example.org/"]
617                           pushInsteadOf = git://example.org/
618
619       a URL like "git://example.org/path/to/repo.git" will be rewritten to
620       "ssh://example.org/path/to/repo.git" for pushes, but pulls will still
621       use the original URL.
622

REMOTES

624       The name of one of the following can be used instead of a URL as
625       <repository> argument:
626
627       •   a remote in the Git configuration file: $GIT_DIR/config,
628
629       •   a file in the $GIT_DIR/remotes directory, or
630
631       •   a file in the $GIT_DIR/branches directory.
632
633       All of these also allow you to omit the refspec from the command line
634       because they each contain a refspec which git will use by default.
635
636   Named remote in configuration file
637       You can choose to provide the name of a remote which you had previously
638       configured using git-remote(1), git-config(1) or even by a manual edit
639       to the $GIT_DIR/config file. The URL of this remote will be used to
640       access the repository. The refspec of this remote will be used by
641       default when you do not provide a refspec on the command line. The
642       entry in the config file would appear like this:
643
644                   [remote "<name>"]
645                           url = <url>
646                           pushurl = <pushurl>
647                           push = <refspec>
648                           fetch = <refspec>
649
650       The <pushurl> is used for pushes only. It is optional and defaults to
651       <url>.
652
653   Named file in $GIT_DIR/remotes
654       You can choose to provide the name of a file in $GIT_DIR/remotes. The
655       URL in this file will be used to access the repository. The refspec in
656       this file will be used as default when you do not provide a refspec on
657       the command line. This file should have the following format:
658
659                   URL: one of the above URL format
660                   Push: <refspec>
661                   Pull: <refspec>
662
663       Push: lines are used by git push and Pull: lines are used by git pull
664       and git fetch. Multiple Push: and Pull: lines may be specified for
665       additional branch mappings.
666
667   Named file in $GIT_DIR/branches
668       You can choose to provide the name of a file in $GIT_DIR/branches. The
669       URL in this file will be used to access the repository. This file
670       should have the following format:
671
672                   <url>#<head>
673
674       <url> is required; #<head> is optional.
675
676       Depending on the operation, git will use one of the following refspecs,
677       if you don’t provide one on the command line. <branch> is the name of
678       this file in $GIT_DIR/branches and <head> defaults to master.
679
680       git fetch uses:
681
682                   refs/heads/<head>:refs/heads/<branch>
683
684       git push uses:
685
686                   HEAD:refs/heads/<head>
687

MERGE STRATEGIES

689       The merge mechanism (git merge and git pull commands) allows the
690       backend merge strategies to be chosen with -s option. Some strategies
691       can also take their own options, which can be passed by giving
692       -X<option> arguments to git merge and/or git pull.
693
694       resolve
695           This can only resolve two heads (i.e. the current branch and
696           another branch you pulled from) using a 3-way merge algorithm. It
697           tries to carefully detect criss-cross merge ambiguities and is
698           considered generally safe and fast.
699
700       recursive
701           This can only resolve two heads using a 3-way merge algorithm. When
702           there is more than one common ancestor that can be used for 3-way
703           merge, it creates a merged tree of the common ancestors and uses
704           that as the reference tree for the 3-way merge. This has been
705           reported to result in fewer merge conflicts without causing
706           mismerges by tests done on actual merge commits taken from Linux
707           2.6 kernel development history. Additionally this can detect and
708           handle merges involving renames, but currently cannot make use of
709           detected copies. This is the default merge strategy when pulling or
710           merging one branch.
711
712           The recursive strategy can take the following options:
713
714           ours
715               This option forces conflicting hunks to be auto-resolved
716               cleanly by favoring our version. Changes from the other tree
717               that do not conflict with our side are reflected in the merge
718               result. For a binary file, the entire contents are taken from
719               our side.
720
721               This should not be confused with the ours merge strategy, which
722               does not even look at what the other tree contains at all. It
723               discards everything the other tree did, declaring our history
724               contains all that happened in it.
725
726           theirs
727               This is the opposite of ours; note that, unlike ours, there is
728               no theirs merge strategy to confuse this merge option with.
729
730           patience
731               With this option, merge-recursive spends a little extra time to
732               avoid mismerges that sometimes occur due to unimportant
733               matching lines (e.g., braces from distinct functions). Use this
734               when the branches to be merged have diverged wildly. See also
735               git-diff(1) --patience.
736
737           diff-algorithm=[patience|minimal|histogram|myers]
738               Tells merge-recursive to use a different diff algorithm, which
739               can help avoid mismerges that occur due to unimportant matching
740               lines (such as braces from distinct functions). See also git-
741               diff(1) --diff-algorithm.
742
743           ignore-space-change, ignore-all-space, ignore-space-at-eol,
744           ignore-cr-at-eol
745               Treats lines with the indicated type of whitespace change as
746               unchanged for the sake of a three-way merge. Whitespace changes
747               mixed with other changes to a line are not ignored. See also
748               git-diff(1) -b, -w, --ignore-space-at-eol, and
749               --ignore-cr-at-eol.
750
751               •   If their version only introduces whitespace changes to a
752                   line, our version is used;
753
754               •   If our version introduces whitespace changes but their
755                   version includes a substantial change, their version is
756                   used;
757
758               •   Otherwise, the merge proceeds in the usual way.
759
760           renormalize
761               This runs a virtual check-out and check-in of all three stages
762               of a file when resolving a three-way merge. This option is
763               meant to be used when merging branches with different clean
764               filters or end-of-line normalization rules. See "Merging
765               branches with differing checkin/checkout attributes" in
766               gitattributes(5) for details.
767
768           no-renormalize
769               Disables the renormalize option. This overrides the
770               merge.renormalize configuration variable.
771
772           no-renames
773               Turn off rename detection. This overrides the merge.renames
774               configuration variable. See also git-diff(1) --no-renames.
775
776           find-renames[=<n>]
777               Turn on rename detection, optionally setting the similarity
778               threshold. This is the default. This overrides the
779               merge.renames configuration variable. See also git-diff(1)
780               --find-renames.
781
782           rename-threshold=<n>
783               Deprecated synonym for find-renames=<n>.
784
785           subtree[=<path>]
786               This option is a more advanced form of subtree strategy, where
787               the strategy makes a guess on how two trees must be shifted to
788               match with each other when merging. Instead, the specified path
789               is prefixed (or stripped from the beginning) to make the shape
790               of two trees to match.
791
792       octopus
793           This resolves cases with more than two heads, but refuses to do a
794           complex merge that needs manual resolution. It is primarily meant
795           to be used for bundling topic branch heads together. This is the
796           default merge strategy when pulling or merging more than one
797           branch.
798
799       ours
800           This resolves any number of heads, but the resulting tree of the
801           merge is always that of the current branch head, effectively
802           ignoring all changes from all other branches. It is meant to be
803           used to supersede old development history of side branches. Note
804           that this is different from the -Xours option to the recursive
805           merge strategy.
806
807       subtree
808           This is a modified recursive strategy. When merging trees A and B,
809           if B corresponds to a subtree of A, B is first adjusted to match
810           the tree structure of A, instead of reading the trees at the same
811           level. This adjustment is also done to the common ancestor tree.
812
813       With the strategies that use 3-way merge (including the default,
814       recursive), if a change is made on both branches, but later reverted on
815       one of the branches, that change will be present in the merged result;
816       some people find this behavior confusing. It occurs because only the
817       heads and the merge base are considered when performing a merge, not
818       the individual commits. The merge algorithm therefore considers the
819       reverted change as no change at all, and substitutes the changed
820       version instead.
821

DEFAULT BEHAVIOUR

823       Often people use git pull without giving any parameter. Traditionally,
824       this has been equivalent to saying git pull origin. However, when
825       configuration branch.<name>.remote is present while on branch <name>,
826       that value is used instead of origin.
827
828       In order to determine what URL to use to fetch from, the value of the
829       configuration remote.<origin>.url is consulted and if there is not any
830       such variable, the value on the URL: line in $GIT_DIR/remotes/<origin>
831       is used.
832
833       In order to determine what remote branches to fetch (and optionally
834       store in the remote-tracking branches) when the command is run without
835       any refspec parameters on the command line, values of the configuration
836       variable remote.<origin>.fetch are consulted, and if there aren’t any,
837       $GIT_DIR/remotes/<origin> is consulted and its Pull: lines are used. In
838       addition to the refspec formats described in the OPTIONS section, you
839       can have a globbing refspec that looks like this:
840
841           refs/heads/*:refs/remotes/origin/*
842
843       A globbing refspec must have a non-empty RHS (i.e. must store what were
844       fetched in remote-tracking branches), and its LHS and RHS must end with
845       /*. The above specifies that all remote branches are tracked using
846       remote-tracking branches in refs/remotes/origin/ hierarchy under the
847       same name.
848
849       The rule to determine which remote branch to merge after fetching is a
850       bit involved, in order not to break backward compatibility.
851
852       If explicit refspecs were given on the command line of git pull, they
853       are all merged.
854
855       When no refspec was given on the command line, then git pull uses the
856       refspec from the configuration or $GIT_DIR/remotes/<origin>. In such
857       cases, the following rules apply:
858
859        1. If branch.<name>.merge configuration for the current branch <name>
860           exists, that is the name of the branch at the remote site that is
861           merged.
862
863        2. If the refspec is a globbing one, nothing is merged.
864
865        3. Otherwise the remote branch of the first refspec is merged.
866

EXAMPLES

868       •   Update the remote-tracking branches for the repository you cloned
869           from, then merge one of them into your current branch:
870
871               $ git pull
872               $ git pull origin
873
874           Normally the branch merged in is the HEAD of the remote repository,
875           but the choice is determined by the branch.<name>.remote and
876           branch.<name>.merge options; see git-config(1) for details.
877
878       •   Merge into the current branch the remote branch next:
879
880               $ git pull origin next
881
882           This leaves a copy of next temporarily in FETCH_HEAD, and updates
883           the remote-tracking branch origin/next. The same can be done by
884           invoking fetch and merge:
885
886               $ git fetch origin
887               $ git merge origin/next
888
889       If you tried a pull which resulted in complex conflicts and would want
890       to start over, you can recover with git reset.
891

SECURITY

893       The fetch and push protocols are not designed to prevent one side from
894       stealing data from the other repository that was not intended to be
895       shared. If you have private data that you need to protect from a
896       malicious peer, your best option is to store it in another repository.
897       This applies to both clients and servers. In particular, namespaces on
898       a server are not effective for read access control; you should only
899       grant read access to a namespace to clients that you would trust with
900       read access to the entire repository.
901
902       The known attack vectors are as follows:
903
904        1. The victim sends "have" lines advertising the IDs of objects it has
905           that are not explicitly intended to be shared but can be used to
906           optimize the transfer if the peer also has them. The attacker
907           chooses an object ID X to steal and sends a ref to X, but isn’t
908           required to send the content of X because the victim already has
909           it. Now the victim believes that the attacker has X, and it sends
910           the content of X back to the attacker later. (This attack is most
911           straightforward for a client to perform on a server, by creating a
912           ref to X in the namespace the client has access to and then
913           fetching it. The most likely way for a server to perform it on a
914           client is to "merge" X into a public branch and hope that the user
915           does additional work on this branch and pushes it back to the
916           server without noticing the merge.)
917
918        2. As in #1, the attacker chooses an object ID X to steal. The victim
919           sends an object Y that the attacker already has, and the attacker
920           falsely claims to have X and not Y, so the victim sends Y as a
921           delta against X. The delta reveals regions of X that are similar to
922           Y to the attacker.
923

BUGS

925       Using --recurse-submodules can only fetch new commits in already
926       checked out submodules right now. When e.g. upstream added a new
927       submodule in the just fetched commits of the superproject the submodule
928       itself cannot be fetched, making it impossible to check out that
929       submodule later without having to do a fetch again. This is expected to
930       be fixed in a future Git version.
931

SEE ALSO

933       git-fetch(1), git-merge(1), git-config(1)
934

GIT

936       Part of the git(1) suite
937
938
939
940Git 2.31.1                        2021-03-26                       GIT-PULL(1)
Impressum