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       --depth=<depth>
266           Limit fetching to the specified number of commits from the tip of
267           each remote branch history. If fetching to a shallow repository
268           created by git clone with --depth=<depth> option (see git-
269           clone(1)), deepen or shorten the history to the specified number of
270           commits. Tags for the deepened commits are not fetched.
271
272       --deepen=<depth>
273           Similar to --depth, except it specifies the number of commits from
274           the current shallow boundary instead of from the tip of each remote
275           branch history.
276
277       --shallow-since=<date>
278           Deepen or shorten the history of a shallow repository to include
279           all reachable commits after <date>.
280
281       --shallow-exclude=<revision>
282           Deepen or shorten the history of a shallow repository to exclude
283           commits reachable from a specified remote branch or tag. This
284           option can be specified multiple times.
285
286       --unshallow
287           If the source repository is complete, convert a shallow repository
288           to a complete one, removing all the limitations imposed by shallow
289           repositories.
290
291           If the source repository is shallow, fetch as much as possible so
292           that the current repository has the same history as the source
293           repository.
294
295       --update-shallow
296           By default when fetching from a shallow repository, git fetch
297           refuses refs that require updating .git/shallow. This option
298           updates .git/shallow and accept such refs.
299
300       --negotiation-tip=<commit|glob>
301           By default, Git will report, to the server, commits reachable from
302           all local refs to find common commits in an attempt to reduce the
303           size of the to-be-received packfile. If specified, Git will only
304           report commits reachable from the given tips. This is useful to
305           speed up fetches when the user knows which local ref is likely to
306           have commits in common with the upstream ref being fetched.
307
308           This option may be specified more than once; if so, Git will report
309           commits reachable from any of the given commits.
310
311           The argument to this option may be a glob on ref names, a ref, or
312           the (possibly abbreviated) SHA-1 of a commit. Specifying a glob is
313           equivalent to specifying this option multiple times, one for each
314           matching ref name.
315
316           See also the fetch.negotiationAlgorithm configuration variable
317           documented in git-config(1).
318
319       --dry-run
320           Show what would be done, without making any changes.
321
322       -f, --force
323           When git fetch is used with <src>:<dst> refspec it may refuse to
324           update the local branch as discussed in the <refspec> part of the
325           git-fetch(1) documentation. This option overrides that check.
326
327       -k, --keep
328           Keep downloaded pack.
329
330       -p, --prune
331           Before fetching, remove any remote-tracking references that no
332           longer exist on the remote. Tags are not subject to pruning if they
333           are fetched only because of the default tag auto-following or due
334           to a --tags option. However, if tags are fetched due to an explicit
335           refspec (either on the command line or in the remote configuration,
336           for example if the remote was cloned with the --mirror option),
337           then they are also subject to pruning. Supplying --prune-tags is a
338           shorthand for providing the tag refspec.
339
340       --no-tags
341           By default, tags that point at objects that are downloaded from the
342           remote repository are fetched and stored locally. This option
343           disables this automatic tag following. The default behavior for a
344           remote may be specified with the remote.<name>.tagOpt setting. See
345           git-config(1).
346
347       --refmap=<refspec>
348           When fetching refs listed on the command line, use the specified
349           refspec (can be given more than once) to map the refs to
350           remote-tracking branches, instead of the values of remote.*.fetch
351           configuration variables for the remote repository. Providing an
352           empty <refspec> to the --refmap option causes Git to ignore the
353           configured refspecs and rely entirely on the refspecs supplied as
354           command-line arguments. See section on "Configured Remote-tracking
355           Branches" for details.
356
357       -t, --tags
358           Fetch all tags from the remote (i.e., fetch remote tags refs/tags/*
359           into local tags with the same name), in addition to whatever else
360           would otherwise be fetched. Using this option alone does not
361           subject tags to pruning, even if --prune is used (though tags may
362           be pruned anyway if they are also the destination of an explicit
363           refspec; see --prune).
364
365       -j, --jobs=<n>
366           Number of parallel children to be used for all forms of fetching.
367
368           If the --multiple option was specified, the different remotes will
369           be fetched in parallel. If multiple submodules are fetched, they
370           will be fetched in parallel. To control them independently, use the
371           config settings fetch.parallel and submodule.fetchJobs (see git-
372           config(1)).
373
374           Typically, parallel recursive and multi-remote fetches will be
375           faster. By default fetches are performed sequentially, not in
376           parallel.
377
378       --set-upstream
379           If the remote is fetched successfully, add upstream (tracking)
380           reference, used by argument-less git-pull(1) and other commands.
381           For more information, see branch.<name>.merge and
382           branch.<name>.remote in git-config(1).
383
384       --upload-pack <upload-pack>
385           When given, and the repository to fetch from is handled by git
386           fetch-pack, --exec=<upload-pack> is passed to the command to
387           specify non-default path for the command run on the other end.
388
389       --progress
390           Progress status is reported on the standard error stream by default
391           when it is attached to a terminal, unless -q is specified. This
392           flag forces progress status even if the standard error stream is
393           not directed to a terminal.
394
395       -o <option>, --server-option=<option>
396           Transmit the given string to the server when communicating using
397           protocol version 2. The given string must not contain a NUL or LF
398           character. The server’s handling of server options, including
399           unknown ones, is server-specific. When multiple
400           --server-option=<option> are given, they are all sent to the other
401           side in the order listed on the command line.
402
403       --show-forced-updates
404           By default, git checks if a branch is force-updated during fetch.
405           This can be disabled through fetch.showForcedUpdates, but the
406           --show-forced-updates option guarantees this check occurs. See git-
407           config(1).
408
409       --no-show-forced-updates
410           By default, git checks if a branch is force-updated during fetch.
411           Pass --no-show-forced-updates or set fetch.showForcedUpdates to
412           false to skip this check for performance reasons. If used during
413           git-pull the --ff-only option will still check for forced updates
414           before attempting a fast-forward update. See git-config(1).
415
416       -4, --ipv4
417           Use IPv4 addresses only, ignoring IPv6 addresses.
418
419       -6, --ipv6
420           Use IPv6 addresses only, ignoring IPv4 addresses.
421
422       <repository>
423           The "remote" repository that is the source of a fetch or pull
424           operation. This parameter can be either a URL (see the section GIT
425           URLS below) or the name of a remote (see the section REMOTES
426           below).
427
428       <refspec>
429           Specifies which refs to fetch and which local refs to update. When
430           no <refspec>s appear on the command line, the refs to fetch are
431           read from remote.<repository>.fetch variables instead (see the
432           section "CONFIGURED REMOTE-TRACKING BRANCHES" in git-fetch(1)).
433
434           The format of a <refspec> parameter is an optional plus +, followed
435           by the source <src>, followed by a colon :, followed by the
436           destination ref <dst>. The colon can be omitted when <dst> is
437           empty. <src> is typically a ref, but it can also be a fully spelled
438           hex object name.
439
440           A <refspec> may contain a * in its <src> to indicate a simple
441           pattern match. Such a refspec functions like a glob that matches
442           any ref with the same prefix. A pattern <refspec> must have a * in
443           both the <src> and <dst>. It will map refs to the destination by
444           replacing the * with the contents matched from the source.
445
446           If a refspec is prefixed by ^, it will be interpreted as a negative
447           refspec. Rather than specifying which refs to fetch or which local
448           refs to update, such a refspec will instead specify refs to
449           exclude. A ref will be considered to match if it matches at least
450           one positive refspec, and does not match any negative refspec.
451           Negative refspecs can be useful to restrict the scope of a pattern
452           refspec so that it will not include specific refs. Negative
453           refspecs can themselves be pattern refspecs. However, they may only
454           contain a <src> and do not specify a <dst>. Fully spelled out hex
455           object names are also not supported.
456
457           tag <tag> means the same as refs/tags/<tag>:refs/tags/<tag>; it
458           requests fetching everything up to the given tag.
459
460           The remote ref that matches <src> is fetched, and if <dst> is not
461           an empty string, an attempt is made to update the local ref that
462           matches it.
463
464           Whether that update is allowed without --force depends on the ref
465           namespace it’s being fetched to, the type of object being fetched,
466           and whether the update is considered to be a fast-forward.
467           Generally, the same rules apply for fetching as when pushing, see
468           the <refspec>...  section of git-push(1) for what those are.
469           Exceptions to those rules particular to git fetch are noted below.
470
471           Until Git version 2.20, and unlike when pushing with git-push(1),
472           any updates to refs/tags/* would be accepted without + in the
473           refspec (or --force). When fetching, we promiscuously considered
474           all tag updates from a remote to be forced fetches. Since Git
475           version 2.20, fetching to update refs/tags/* works the same way as
476           when pushing. I.e. any updates will be rejected without + in the
477           refspec (or --force).
478
479           Unlike when pushing with git-push(1), any updates outside of
480           refs/{tags,heads}/* will be accepted without + in the refspec (or
481           --force), whether that’s swapping e.g. a tree object for a blob, or
482           a commit for another commit that’s doesn’t have the previous commit
483           as an ancestor etc.
484
485           Unlike when pushing with git-push(1), there is no configuration
486           which’ll amend these rules, and nothing like a pre-fetch hook
487           analogous to the pre-receive hook.
488
489           As with pushing with git-push(1), all of the rules described above
490           about what’s not allowed as an update can be overridden by adding
491           an the optional leading + to a refspec (or using --force command
492           line option). The only exception to this is that no amount of
493           forcing will make the refs/heads/* namespace accept a non-commit
494           object.
495
496               Note
497               When the remote branch you want to fetch is known to be rewound
498               and rebased regularly, it is expected that its new tip will not
499               be descendant of its previous tip (as stored in your
500               remote-tracking branch the last time you fetched). You would
501               want to use the + sign to indicate non-fast-forward updates
502               will be needed for such branches. There is no way to determine
503               or declare that a branch will be made available in a repository
504               with this behavior; the pulling user simply must know this is
505               the expected usage pattern for a branch.
506
507               Note
508               There is a difference between listing multiple <refspec>
509               directly on git pull command line and having multiple
510               remote.<repository>.fetch entries in your configuration for a
511               <repository> and running a git pull command without any
512               explicit <refspec> parameters. <refspec>s listed explicitly on
513               the command line are always merged into the current branch
514               after fetching. In other words, if you list more than one
515               remote ref, git pull will create an Octopus merge. On the other
516               hand, if you do not list any explicit <refspec> parameter on
517               the command line, git pull will fetch all the <refspec>s it
518               finds in the remote.<repository>.fetch configuration and merge
519               only the first <refspec> found into the current branch. This is
520               because making an Octopus from remote refs is rarely done,
521               while keeping track of multiple remote heads in one-go by
522               fetching more than one is often useful.
523

GIT URLS

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

REMOTES

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

MERGE STRATEGIES

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

DEFAULT BEHAVIOUR

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

EXAMPLES

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

SECURITY

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

BUGS

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

SEE ALSO

929       git-fetch(1), git-merge(1), git-config(1)
930

GIT

932       Part of the git(1) suite
933
934
935
936Git 2.30.2                        2021-03-08                       GIT-PULL(1)
Impressum