1GIT-PULL(1) Git Manual GIT-PULL(1)
2
3
4
6 git-pull - Fetch from and integrate with another repository or a local
7 branch
8
10 git pull [<options>] [<repository> [<refspec>...]]
11
12
14 Incorporates changes from a remote repository into the current branch.
15 In its default mode, git pull is shorthand for git fetch followed by
16 git merge FETCH_HEAD.
17
18 More precisely, git pull runs git fetch with the given parameters and
19 calls git merge to merge the retrieved branch heads into the current
20 branch. With --rebase, it runs git rebase instead of git merge.
21
22 <repository> should be the name of a remote repository as passed to
23 git-fetch(1). <refspec> can name an arbitrary remote ref (for example,
24 the name of a tag) or even a collection of refs with corresponding
25 remote-tracking branches (e.g., refs/heads/*:refs/remotes/origin/*),
26 but usually it is the name of a branch in the remote repository.
27
28 Default values for <repository> and <branch> are read from the "remote"
29 and "merge" configuration for the current branch as set by git-
30 branch(1) --track.
31
32 Assume the following history exists and the current branch is "master":
33
34 A---B---C master on origin
35 /
36 D---E---F---G master
37 ^
38 origin/master in your repository
39
40
41 Then "git pull" will fetch and replay the changes from the remote
42 master branch since it diverged from the local master (i.e., E) until
43 its current commit (C) on top of master and record the result in a new
44 commit along with the names of the two parent commits and a log message
45 from the user describing the changes.
46
47 A---B---C origin/master
48 / \
49 D---E---F---G---H master
50
51
52 See git-merge(1) for details, including how conflicts are presented and
53 handled.
54
55 In Git 1.7.0 or later, to cancel a conflicting merge, use git reset
56 --merge. Warning: In older versions of Git, running git pull with
57 uncommitted changes is discouraged: while possible, it leaves you in a
58 state that may be hard to back out of in the case of a conflict.
59
60 If any of the remote changes overlap with local uncommitted changes,
61 the merge will be automatically canceled and the work tree untouched.
62 It is generally best to get any local changes in working order before
63 pulling or stash them away with git-stash(1).
64
66 -q, --quiet
67 This is passed to both underlying git-fetch to squelch reporting of
68 during transfer, and underlying git-merge to squelch output during
69 merging.
70
71 -v, --verbose
72 Pass --verbose to git-fetch and git-merge.
73
74 --[no-]recurse-submodules[=yes|on-demand|no]
75 This option controls if new commits of all populated submodules
76 should be fetched and updated, too (see git-config(1) and
77 gitmodules(5)).
78
79 If the checkout is done via rebase, local submodule commits are
80 rebased as well.
81
82 If the update is done via merge, the submodule conflicts are
83 resolved and checked out.
84
85 Options related to merging
86 --commit, --no-commit
87 Perform the merge and commit the result. This option can be used to
88 override --no-commit.
89
90 With --no-commit perform the merge but pretend the merge failed and
91 do not autocommit, to give the user a chance to inspect and further
92 tweak the merge result before committing.
93
94 --edit, -e, --no-edit
95 Invoke an editor before committing successful mechanical merge to
96 further edit the auto-generated merge message, so that the user can
97 explain and justify the merge. The --no-edit option can be used to
98 accept the auto-generated message (this is generally discouraged).
99
100 Older scripts may depend on the historical behaviour of not
101 allowing the user to edit the merge log message. They will see an
102 editor opened when they run git merge. To make it easier to adjust
103 such scripts to the updated behaviour, the environment variable
104 GIT_MERGE_AUTOEDIT can be set to no at the beginning of them.
105
106 --ff
107 When the merge resolves as a fast-forward, only update the branch
108 pointer, without creating a merge commit. This is the default
109 behavior.
110
111 --no-ff
112 Create a merge commit even when the merge resolves as a
113 fast-forward. This is the default behaviour when merging an
114 annotated (and possibly signed) tag that is not stored in its
115 natural place in refs/tags/ hierarchy.
116
117 --ff-only
118 Refuse to merge and exit with a non-zero status unless the current
119 HEAD is already up to date or the merge can be resolved as a
120 fast-forward.
121
122 -S[<keyid>], --gpg-sign[=<keyid>]
123 GPG-sign the resulting merge commit. The keyid argument is optional
124 and defaults to the committer identity; if specified, it must be
125 stuck to the option without a space.
126
127 --log[=<n>], --no-log
128 In addition to branch names, populate the log message with one-line
129 descriptions from at most <n> actual commits that are being merged.
130 See also git-fmt-merge-msg(1).
131
132 With --no-log do not list one-line descriptions from the actual
133 commits being merged.
134
135 --signoff, --no-signoff
136 Add Signed-off-by line by the committer at the end of the commit
137 log message. The meaning of a signoff depends on the project, but
138 it typically certifies that committer has the rights to submit this
139 work under the same license and agrees to a Developer Certificate
140 of Origin (see http://developercertificate.org/ for more
141 information).
142
143 With --no-signoff do not add a Signed-off-by line.
144
145 --stat, -n, --no-stat
146 Show a diffstat at the end of the merge. The diffstat is also
147 controlled by the configuration option merge.stat.
148
149 With -n or --no-stat do not show a diffstat at the end of the
150 merge.
151
152 --squash, --no-squash
153 Produce the working tree and index state as if a real merge
154 happened (except for the merge information), but do not actually
155 make a commit, move the HEAD, or record $GIT_DIR/MERGE_HEAD (to
156 cause the next git commit command to create a merge commit). This
157 allows you to create a single commit on top of the current branch
158 whose effect is the same as merging another branch (or more in case
159 of an octopus).
160
161 With --no-squash perform the merge and commit the result. This
162 option can be used to override --squash.
163
164 -s <strategy>, --strategy=<strategy>
165 Use the given merge strategy; can be supplied more than once to
166 specify them in the order they should be tried. If there is no -s
167 option, a built-in list of strategies is used instead (git
168 merge-recursive when merging a single head, git merge-octopus
169 otherwise).
170
171 -X <option>, --strategy-option=<option>
172 Pass merge strategy specific option through to the merge strategy.
173
174 --verify-signatures, --no-verify-signatures
175 Verify that the tip commit of the side branch being merged is
176 signed with a valid key, i.e. a key that has a valid uid: in the
177 default trust model, this means the signing key has been signed by
178 a trusted key. If the tip commit of the side branch is not signed
179 with a valid key, the merge is aborted.
180
181 --summary, --no-summary
182 Synonyms to --stat and --no-stat; these are deprecated and will be
183 removed in the future.
184
185 --allow-unrelated-histories
186 By default, git merge command refuses to merge histories that do
187 not share a common ancestor. This option can be used to override
188 this safety when merging histories of two projects that started
189 their lives independently. As that is a very rare occasion, no
190 configuration variable to enable this by default exists and will
191 not be added.
192
193 -r, --rebase[=false|true|merges|preserve|interactive]
194 When true, rebase the current branch on top of the upstream branch
195 after fetching. If there is a remote-tracking branch corresponding
196 to the upstream branch and the upstream branch was rebased since
197 last fetched, the rebase uses that information to avoid rebasing
198 non-local changes.
199
200 When set to merges, rebase using git rebase --rebase-merges so that
201 the local merge commits are included in the rebase (see git-
202 rebase(1) for details).
203
204 When set to preserve, rebase with the --preserve-merges option
205 passed to git rebase so that locally created merge commits will not
206 be flattened.
207
208 When false, merge the current branch into the upstream branch.
209
210 When interactive, enable the interactive mode of rebase.
211
212 See pull.rebase, branch.<name>.rebase and branch.autoSetupRebase in
213 git-config(1) if you want to make git pull always use --rebase
214 instead of merging.
215
216 Note
217 This is a potentially dangerous mode of operation. It rewrites
218 history, which does not bode well when you published that
219 history already. Do not use this option unless you have read
220 git-rebase(1) carefully.
221
222 --no-rebase
223 Override earlier --rebase.
224
225 --autostash, --no-autostash
226 Before starting rebase, stash local modifications away (see git-
227 stash(1)) if needed, and apply the stash entry when done.
228 --no-autostash is useful to override the rebase.autoStash
229 configuration variable (see git-config(1)).
230
231 This option is only valid when "--rebase" is used.
232
233 Options related to fetching
234 --all
235 Fetch all remotes.
236
237 -a, --append
238 Append ref names and object names of fetched refs to the existing
239 contents of .git/FETCH_HEAD. Without this option old data in
240 .git/FETCH_HEAD will be overwritten.
241
242 --depth=<depth>
243 Limit fetching to the specified number of commits from the tip of
244 each remote branch history. If fetching to a shallow repository
245 created by git clone with --depth=<depth> option (see git-
246 clone(1)), deepen or shorten the history to the specified number of
247 commits. Tags for the deepened commits are not fetched.
248
249 --deepen=<depth>
250 Similar to --depth, except it specifies the number of commits from
251 the current shallow boundary instead of from the tip of each remote
252 branch history.
253
254 --shallow-since=<date>
255 Deepen or shorten the history of a shallow repository to include
256 all reachable commits after <date>.
257
258 --shallow-exclude=<revision>
259 Deepen or shorten the history of a shallow repository to exclude
260 commits reachable from a specified remote branch or tag. This
261 option can be specified multiple times.
262
263 --unshallow
264 If the source repository is complete, convert a shallow repository
265 to a complete one, removing all the limitations imposed by shallow
266 repositories.
267
268 If the source repository is shallow, fetch as much as possible so
269 that the current repository has the same history as the source
270 repository.
271
272 --update-shallow
273 By default when fetching from a shallow repository, git fetch
274 refuses refs that require updating .git/shallow. This option
275 updates .git/shallow and accept such refs.
276
277 -f, --force
278 When git fetch is used with <rbranch>:<lbranch> refspec, it refuses
279 to update the local branch <lbranch> unless the remote branch
280 <rbranch> it fetches is a descendant of <lbranch>. This option
281 overrides that check.
282
283 -k, --keep
284 Keep downloaded pack.
285
286 --no-tags
287 By default, tags that point at objects that are downloaded from the
288 remote repository are fetched and stored locally. This option
289 disables this automatic tag following. The default behavior for a
290 remote may be specified with the remote.<name>.tagOpt setting. See
291 git-config(1).
292
293 -u, --update-head-ok
294 By default git fetch refuses to update the head which corresponds
295 to the current branch. This flag disables the check. This is purely
296 for the internal use for git pull to communicate with git fetch,
297 and unless you are implementing your own Porcelain you are not
298 supposed to use it.
299
300 --upload-pack <upload-pack>
301 When given, and the repository to fetch from is handled by git
302 fetch-pack, --exec=<upload-pack> is passed to the command to
303 specify non-default path for the command run on the other end.
304
305 --progress
306 Progress status is reported on the standard error stream by default
307 when it is attached to a terminal, unless -q is specified. This
308 flag forces progress status even if the standard error stream is
309 not directed to a terminal.
310
311 -o <option>, --server-option=<option>
312 Transmit the given string to the server when communicating using
313 protocol version 2. The given string must not contain a NUL or LF
314 character. When multiple --server-option=<option> are given, they
315 are all sent to the other side in the order listed on the command
316 line.
317
318 -4, --ipv4
319 Use IPv4 addresses only, ignoring IPv6 addresses.
320
321 -6, --ipv6
322 Use IPv6 addresses only, ignoring IPv4 addresses.
323
324 <repository>
325 The "remote" repository that is the source of a fetch or pull
326 operation. This parameter can be either a URL (see the section GIT
327 URLS below) or the name of a remote (see the section REMOTES
328 below).
329
330 <refspec>
331 Specifies which refs to fetch and which local refs to update. When
332 no <refspec>s appear on the command line, the refs to fetch are
333 read from remote.<repository>.fetch variables instead (see git-
334 fetch(1)).
335
336 The format of a <refspec> parameter is an optional plus +, followed
337 by the source <src>, followed by a colon :, followed by the
338 destination ref <dst>. The colon can be omitted when <dst> is
339 empty. <src> is typically a ref, but it can also be a fully spelled
340 hex object name.
341
342 tag <tag> means the same as refs/tags/<tag>:refs/tags/<tag>; it
343 requests fetching everything up to the given tag.
344
345 The remote ref that matches <src> is fetched, and if <dst> is not
346 empty string, the local ref that matches it is fast-forwarded using
347 <src>. If the optional plus + is used, the local ref is updated
348 even if it does not result in a fast-forward update.
349
350 Note
351 When the remote branch you want to fetch is known to be rewound
352 and rebased regularly, it is expected that its new tip will not
353 be descendant of its previous tip (as stored in your
354 remote-tracking branch the last time you fetched). You would
355 want to use the + sign to indicate non-fast-forward updates
356 will be needed for such branches. There is no way to determine
357 or declare that a branch will be made available in a repository
358 with this behavior; the pulling user simply must know this is
359 the expected usage pattern for a branch.
360
361 Note
362 There is a difference between listing multiple <refspec>
363 directly on git pull command line and having multiple
364 remote.<repository>.fetch entries in your configuration for a
365 <repository> and running a git pull command without any
366 explicit <refspec> parameters. <refspec>s listed explicitly on
367 the command line are always merged into the current branch
368 after fetching. In other words, if you list more than one
369 remote ref, git pull will create an Octopus merge. On the other
370 hand, if you do not list any explicit <refspec> parameter on
371 the command line, git pull will fetch all the <refspec>s it
372 finds in the remote.<repository>.fetch configuration and merge
373 only the first <refspec> found into the current branch. This is
374 because making an Octopus from remote refs is rarely done,
375 while keeping track of multiple remote heads in one-go by
376 fetching more than one is often useful.
377
379 In general, URLs contain information about the transport protocol, the
380 address of the remote server, and the path to the repository. Depending
381 on the transport protocol, some of this information may be absent.
382
383 Git supports ssh, git, http, and https protocols (in addition, ftp, and
384 ftps can be used for fetching, but this is inefficient and deprecated;
385 do not use it).
386
387 The native transport (i.e. git:// URL) does no authentication and
388 should be used with caution on unsecured networks.
389
390 The following syntaxes may be used with them:
391
392 · ssh://[user@]host.xz[:port]/path/to/repo.git/
393
394 · git://host.xz[:port]/path/to/repo.git/
395
396 · http[s]://host.xz[:port]/path/to/repo.git/
397
398 · ftp[s]://host.xz[:port]/path/to/repo.git/
399
400 An alternative scp-like syntax may also be used with the ssh protocol:
401
402 · [user@]host.xz:path/to/repo.git/
403
404 This syntax is only recognized if there are no slashes before the first
405 colon. This helps differentiate a local path that contains a colon. For
406 example the local path foo:bar could be specified as an absolute path
407 or ./foo:bar to avoid being misinterpreted as an ssh url.
408
409 The ssh and git protocols additionally support ~username expansion:
410
411 · ssh://[user@]host.xz[:port]/~[user]/path/to/repo.git/
412
413 · git://host.xz[:port]/~[user]/path/to/repo.git/
414
415 · [user@]host.xz:/~[user]/path/to/repo.git/
416
417 For local repositories, also supported by Git natively, the following
418 syntaxes may be used:
419
420 · /path/to/repo.git/
421
422 · file:///path/to/repo.git/
423
424 These two syntaxes are mostly equivalent, except when cloning, when the
425 former implies --local option. See git-clone(1) for details.
426
427 When Git doesn’t know how to handle a certain transport protocol, it
428 attempts to use the remote-<transport> remote helper, if one exists. To
429 explicitly request a remote helper, the following syntax may be used:
430
431 · <transport>::<address>
432
433 where <address> may be a path, a server and path, or an arbitrary
434 URL-like string recognized by the specific remote helper being invoked.
435 See gitremote-helpers(1) for details.
436
437 If there are a large number of similarly-named remote repositories and
438 you want to use a different format for them (such that the URLs you use
439 will be rewritten into URLs that work), you can create a configuration
440 section of the form:
441
442 [url "<actual url base>"]
443 insteadOf = <other url base>
444
445
446 For example, with this:
447
448 [url "git://git.host.xz/"]
449 insteadOf = host.xz:/path/to/
450 insteadOf = work:
451
452
453 a URL like "work:repo.git" or like "host.xz:/path/to/repo.git" will be
454 rewritten in any context that takes a URL to be
455 "git://git.host.xz/repo.git".
456
457 If you want to rewrite URLs for push only, you can create a
458 configuration section of the form:
459
460 [url "<actual url base>"]
461 pushInsteadOf = <other url base>
462
463
464 For example, with this:
465
466 [url "ssh://example.org/"]
467 pushInsteadOf = git://example.org/
468
469
470 a URL like "git://example.org/path/to/repo.git" will be rewritten to
471 "ssh://example.org/path/to/repo.git" for pushes, but pulls will still
472 use the original URL.
473
475 The name of one of the following can be used instead of a URL as
476 <repository> argument:
477
478 · a remote in the Git configuration file: $GIT_DIR/config,
479
480 · a file in the $GIT_DIR/remotes directory, or
481
482 · a file in the $GIT_DIR/branches directory.
483
484 All of these also allow you to omit the refspec from the command line
485 because they each contain a refspec which git will use by default.
486
487 Named remote in configuration file
488 You can choose to provide the name of a remote which you had previously
489 configured using git-remote(1), git-config(1) or even by a manual edit
490 to the $GIT_DIR/config file. The URL of this remote will be used to
491 access the repository. The refspec of this remote will be used by
492 default when you do not provide a refspec on the command line. The
493 entry in the config file would appear like this:
494
495 [remote "<name>"]
496 url = <url>
497 pushurl = <pushurl>
498 push = <refspec>
499 fetch = <refspec>
500
501
502 The <pushurl> is used for pushes only. It is optional and defaults to
503 <url>.
504
505 Named file in $GIT_DIR/remotes
506 You can choose to provide the name of a file in $GIT_DIR/remotes. The
507 URL in this file will be used to access the repository. The refspec in
508 this file will be used as default when you do not provide a refspec on
509 the command line. This file should have the following format:
510
511 URL: one of the above URL format
512 Push: <refspec>
513 Pull: <refspec>
514
515
516 Push: lines are used by git push and Pull: lines are used by git pull
517 and git fetch. Multiple Push: and Pull: lines may be specified for
518 additional branch mappings.
519
520 Named file in $GIT_DIR/branches
521 You can choose to provide the name of a file in $GIT_DIR/branches. The
522 URL in this file will be used to access the repository. This file
523 should have the following format:
524
525 <url>#<head>
526
527
528 <url> is required; #<head> is optional.
529
530 Depending on the operation, git will use one of the following refspecs,
531 if you don’t provide one on the command line. <branch> is the name of
532 this file in $GIT_DIR/branches and <head> defaults to master.
533
534 git fetch uses:
535
536 refs/heads/<head>:refs/heads/<branch>
537
538
539 git push uses:
540
541 HEAD:refs/heads/<head>
542
543
545 The merge mechanism (git merge and git pull commands) allows the
546 backend merge strategies to be chosen with -s option. Some strategies
547 can also take their own options, which can be passed by giving
548 -X<option> arguments to git merge and/or git pull.
549
550 resolve
551 This can only resolve two heads (i.e. the current branch and
552 another branch you pulled from) using a 3-way merge algorithm. It
553 tries to carefully detect criss-cross merge ambiguities and is
554 considered generally safe and fast.
555
556 recursive
557 This can only resolve two heads using a 3-way merge algorithm. When
558 there is more than one common ancestor that can be used for 3-way
559 merge, it creates a merged tree of the common ancestors and uses
560 that as the reference tree for the 3-way merge. This has been
561 reported to result in fewer merge conflicts without causing
562 mismerges by tests done on actual merge commits taken from Linux
563 2.6 kernel development history. Additionally this can detect and
564 handle merges involving renames, but currently cannot make use of
565 detected copies. This is the default merge strategy when pulling or
566 merging one branch.
567
568 The recursive strategy can take the following options:
569
570 ours
571 This option forces conflicting hunks to be auto-resolved
572 cleanly by favoring our version. Changes from the other tree
573 that do not conflict with our side are reflected to the merge
574 result. For a binary file, the entire contents are taken from
575 our side.
576
577 This should not be confused with the ours merge strategy, which
578 does not even look at what the other tree contains at all. It
579 discards everything the other tree did, declaring our history
580 contains all that happened in it.
581
582 theirs
583 This is the opposite of ours; note that, unlike ours, there is
584 no theirs merge strategy to confuse this merge option with.
585
586 patience
587 With this option, merge-recursive spends a little extra time to
588 avoid mismerges that sometimes occur due to unimportant
589 matching lines (e.g., braces from distinct functions). Use this
590 when the branches to be merged have diverged wildly. See also
591 git-diff(1) --patience.
592
593 diff-algorithm=[patience|minimal|histogram|myers]
594 Tells merge-recursive to use a different diff algorithm, which
595 can help avoid mismerges that occur due to unimportant matching
596 lines (such as braces from distinct functions). See also git-
597 diff(1) --diff-algorithm.
598
599 ignore-space-change, ignore-all-space, ignore-space-at-eol,
600 ignore-cr-at-eol
601 Treats lines with the indicated type of whitespace change as
602 unchanged for the sake of a three-way merge. Whitespace changes
603 mixed with other changes to a line are not ignored. See also
604 git-diff(1) -b, -w, --ignore-space-at-eol, and
605 --ignore-cr-at-eol.
606
607 · If their version only introduces whitespace changes to a
608 line, our version is used;
609
610 · If our version introduces whitespace changes but their
611 version includes a substantial change, their version is
612 used;
613
614 · Otherwise, the merge proceeds in the usual way.
615
616 renormalize
617 This runs a virtual check-out and check-in of all three stages
618 of a file when resolving a three-way merge. This option is
619 meant to be used when merging branches with different clean
620 filters or end-of-line normalization rules. See "Merging
621 branches with differing checkin/checkout attributes" in
622 gitattributes(5) for details.
623
624 no-renormalize
625 Disables the renormalize option. This overrides the
626 merge.renormalize configuration variable.
627
628 no-renames
629 Turn off rename detection. This overrides the merge.renames
630 configuration variable. See also git-diff(1) --no-renames.
631
632 find-renames[=<n>]
633 Turn on rename detection, optionally setting the similarity
634 threshold. This is the default. This overrides the
635 merge.renames configuration variable. See also git-diff(1)
636 --find-renames.
637
638 rename-threshold=<n>
639 Deprecated synonym for find-renames=<n>.
640
641 subtree[=<path>]
642 This option is a more advanced form of subtree strategy, where
643 the strategy makes a guess on how two trees must be shifted to
644 match with each other when merging. Instead, the specified path
645 is prefixed (or stripped from the beginning) to make the shape
646 of two trees to match.
647
648 octopus
649 This resolves cases with more than two heads, but refuses to do a
650 complex merge that needs manual resolution. It is primarily meant
651 to be used for bundling topic branch heads together. This is the
652 default merge strategy when pulling or merging more than one
653 branch.
654
655 ours
656 This resolves any number of heads, but the resulting tree of the
657 merge is always that of the current branch head, effectively
658 ignoring all changes from all other branches. It is meant to be
659 used to supersede old development history of side branches. Note
660 that this is different from the -Xours option to the recursive
661 merge strategy.
662
663 subtree
664 This is a modified recursive strategy. When merging trees A and B,
665 if B corresponds to a subtree of A, B is first adjusted to match
666 the tree structure of A, instead of reading the trees at the same
667 level. This adjustment is also done to the common ancestor tree.
668
669 With the strategies that use 3-way merge (including the default,
670 recursive), if a change is made on both branches, but later reverted on
671 one of the branches, that change will be present in the merged result;
672 some people find this behavior confusing. It occurs because only the
673 heads and the merge base are considered when performing a merge, not
674 the individual commits. The merge algorithm therefore considers the
675 reverted change as no change at all, and substitutes the changed
676 version instead.
677
679 Often people use git pull without giving any parameter. Traditionally,
680 this has been equivalent to saying git pull origin. However, when
681 configuration branch.<name>.remote is present while on branch <name>,
682 that value is used instead of origin.
683
684 In order to determine what URL to use to fetch from, the value of the
685 configuration remote.<origin>.url is consulted and if there is not any
686 such variable, the value on the URL: line in $GIT_DIR/remotes/<origin>
687 is used.
688
689 In order to determine what remote branches to fetch (and optionally
690 store in the remote-tracking branches) when the command is run without
691 any refspec parameters on the command line, values of the configuration
692 variable remote.<origin>.fetch are consulted, and if there aren’t any,
693 $GIT_DIR/remotes/<origin> is consulted and its Pull: lines are used. In
694 addition to the refspec formats described in the OPTIONS section, you
695 can have a globbing refspec that looks like this:
696
697 refs/heads/*:refs/remotes/origin/*
698
699
700 A globbing refspec must have a non-empty RHS (i.e. must store what were
701 fetched in remote-tracking branches), and its LHS and RHS must end with
702 /*. The above specifies that all remote branches are tracked using
703 remote-tracking branches in refs/remotes/origin/ hierarchy under the
704 same name.
705
706 The rule to determine which remote branch to merge after fetching is a
707 bit involved, in order not to break backward compatibility.
708
709 If explicit refspecs were given on the command line of git pull, they
710 are all merged.
711
712 When no refspec was given on the command line, then git pull uses the
713 refspec from the configuration or $GIT_DIR/remotes/<origin>. In such
714 cases, the following rules apply:
715
716 1. If branch.<name>.merge configuration for the current branch <name>
717 exists, that is the name of the branch at the remote site that is
718 merged.
719
720 2. If the refspec is a globbing one, nothing is merged.
721
722 3. Otherwise the remote branch of the first refspec is merged.
723
725 · Update the remote-tracking branches for the repository you cloned
726 from, then merge one of them into your current branch:
727
728 $ git pull
729 $ git pull origin
730
731 Normally the branch merged in is the HEAD of the remote repository,
732 but the choice is determined by the branch.<name>.remote and
733 branch.<name>.merge options; see git-config(1) for details.
734
735 · Merge into the current branch the remote branch next:
736
737 $ git pull origin next
738
739 This leaves a copy of next temporarily in FETCH_HEAD, but does not
740 update any remote-tracking branches. Using remote-tracking
741 branches, the same can be done by invoking fetch and merge:
742
743 $ git fetch origin
744 $ git merge origin/next
745
746
747 If you tried a pull which resulted in complex conflicts and would want
748 to start over, you can recover with git reset.
749
751 The fetch and push protocols are not designed to prevent one side from
752 stealing data from the other repository that was not intended to be
753 shared. If you have private data that you need to protect from a
754 malicious peer, your best option is to store it in another repository.
755 This applies to both clients and servers. In particular, namespaces on
756 a server are not effective for read access control; you should only
757 grant read access to a namespace to clients that you would trust with
758 read access to the entire repository.
759
760 The known attack vectors are as follows:
761
762 1. The victim sends "have" lines advertising the IDs of objects it has
763 that are not explicitly intended to be shared but can be used to
764 optimize the transfer if the peer also has them. The attacker
765 chooses an object ID X to steal and sends a ref to X, but isn’t
766 required to send the content of X because the victim already has
767 it. Now the victim believes that the attacker has X, and it sends
768 the content of X back to the attacker later. (This attack is most
769 straightforward for a client to perform on a server, by creating a
770 ref to X in the namespace the client has access to and then
771 fetching it. The most likely way for a server to perform it on a
772 client is to "merge" X into a public branch and hope that the user
773 does additional work on this branch and pushes it back to the
774 server without noticing the merge.)
775
776 2. As in #1, the attacker chooses an object ID X to steal. The victim
777 sends an object Y that the attacker already has, and the attacker
778 falsely claims to have X and not Y, so the victim sends Y as a
779 delta against X. The delta reveals regions of X that are similar to
780 Y to the attacker.
781
783 Using --recurse-submodules can only fetch new commits in already
784 checked out submodules right now. When e.g. upstream added a new
785 submodule in the just fetched commits of the superproject the submodule
786 itself can not be fetched, making it impossible to check out that
787 submodule later without having to do a fetch again. This is expected to
788 be fixed in a future Git version.
789
791 git-fetch(1), git-merge(1), git-config(1)
792
794 Part of the git(1) suite
795
796
797
798Git 2.18.1 05/14/2019 GIT-PULL(1)