logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

git-pull.1 (50109B)


  1. '\" t
  2. .\" Title: git-pull
  3. .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
  4. .\" Generator: DocBook XSL Stylesheets v1.79.2 <http://docbook.sf.net/>
  5. .\" Date: 2025-03-14
  6. .\" Manual: Git Manual
  7. .\" Source: Git 2.49.0
  8. .\" Language: English
  9. .\"
  10. .TH "GIT\-PULL" "1" "2025-03-14" "Git 2\&.49\&.0" "Git Manual"
  11. .\" -----------------------------------------------------------------
  12. .\" * Define some portability stuff
  13. .\" -----------------------------------------------------------------
  14. .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  15. .\" http://bugs.debian.org/507673
  16. .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
  17. .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  18. .ie \n(.g .ds Aq \(aq
  19. .el .ds Aq '
  20. .\" -----------------------------------------------------------------
  21. .\" * set default formatting
  22. .\" -----------------------------------------------------------------
  23. .\" disable hyphenation
  24. .nh
  25. .\" disable justification (adjust text to left margin only)
  26. .ad l
  27. .\" -----------------------------------------------------------------
  28. .\" * MAIN CONTENT STARTS HERE *
  29. .\" -----------------------------------------------------------------
  30. .SH "NAME"
  31. git-pull \- Fetch from and integrate with another repository or a local branch
  32. .SH "SYNOPSIS"
  33. .sp
  34. .nf
  35. \fIgit pull\fR [<options>] [<repository> [<refspec>\&...\:]]
  36. .fi
  37. .SH "DESCRIPTION"
  38. .sp
  39. Incorporates changes from a remote repository into the current branch\&. If the current branch is behind the remote, then by default it will fast\-forward the current branch to match the remote\&. If the current branch and the remote have diverged, the user needs to specify how to reconcile the divergent branches with \fB\-\-rebase\fR or \fB\-\-no\-rebase\fR (or the corresponding configuration option in \fBpull\&.rebase\fR)\&.
  40. .sp
  41. More precisely, \fBgit\fR \fBpull\fR runs \fBgit\fR \fBfetch\fR with the given parameters and then depending on configuration options or command line flags, will call either \fBgit\fR \fBrebase\fR or \fBgit\fR \fBmerge\fR to reconcile diverging branches\&.
  42. .sp
  43. <repository> should be the name of a remote repository as passed to \fBgit-fetch\fR(1)\&. <refspec> can name an arbitrary remote ref (for example, the name of a tag) or even a collection of refs with corresponding remote\-tracking branches (e\&.g\&., refs/heads/*:refs/remotes/origin/*), but usually it is the name of a branch in the remote repository\&.
  44. .sp
  45. Default values for <repository> and <branch> are read from the "remote" and "merge" configuration for the current branch as set by \fBgit-branch\fR(1) \fB\-\-track\fR\&.
  46. .sp
  47. Assume the following history exists and the current branch is "\fBmaster\fR":
  48. .sp
  49. .if n \{\
  50. .RS 4
  51. .\}
  52. .nf
  53. A\-\-\-B\-\-\-C master on origin
  54. /
  55. D\-\-\-E\-\-\-F\-\-\-G master
  56. ^
  57. origin/master in your repository
  58. .fi
  59. .if n \{\
  60. .RE
  61. .\}
  62. .sp
  63. Then "\fBgit\fR \fBpull\fR" will fetch and replay the changes from the remote \fBmaster\fR branch since it diverged from the local \fBmaster\fR (i\&.e\&., \fBE\fR) until its current commit (\fBC\fR) on top of \fBmaster\fR and record the result in a new commit along with the names of the two parent commits and a log message from the user describing the changes\&.
  64. .sp
  65. .if n \{\
  66. .RS 4
  67. .\}
  68. .nf
  69. A\-\-\-B\-\-\-C origin/master
  70. / \e
  71. D\-\-\-E\-\-\-F\-\-\-G\-\-\-H master
  72. .fi
  73. .if n \{\
  74. .RE
  75. .\}
  76. .sp
  77. See \fBgit-merge\fR(1) for details, including how conflicts are presented and handled\&.
  78. .sp
  79. In Git 1\&.7\&.0 or later, to cancel a conflicting merge, use \fBgit\fR \fBreset\fR \fB\-\-merge\fR\&. \fBWarning\fR: In older versions of Git, running \fIgit pull\fR with uncommitted changes is discouraged: while possible, it leaves you in a state that may be hard to back out of in the case of a conflict\&.
  80. .sp
  81. If any of the remote changes overlap with local uncommitted changes, the merge will be automatically canceled and the work tree untouched\&. It is generally best to get any local changes in working order before pulling or stash them away with \fBgit-stash\fR(1)\&.
  82. .SH "OPTIONS"
  83. .PP
  84. \-q, \-\-quiet
  85. .RS 4
  86. This is passed to both underlying git\-fetch to squelch reporting of during transfer, and underlying git\-merge to squelch output during merging\&.
  87. .RE
  88. .PP
  89. \-v, \-\-verbose
  90. .RS 4
  91. Pass \-\-verbose to git\-fetch and git\-merge\&.
  92. .RE
  93. .PP
  94. \-\-[no\-]recurse\-submodules[=(yes|on\-demand|no)]
  95. .RS 4
  96. This option controls if new commits of populated submodules should be fetched, and if the working trees of active submodules should be updated, too (see
  97. \fBgit-fetch\fR(1),
  98. \fBgit-config\fR(1)
  99. and
  100. \fBgitmodules\fR(5))\&.
  101. .sp
  102. If the checkout is done via rebase, local submodule commits are rebased as well\&.
  103. .sp
  104. If the update is done via merge, the submodule conflicts are resolved and checked out\&.
  105. .RE
  106. .SS "Options related to merging"
  107. .PP
  108. \-\-commit, \-\-no\-commit
  109. .RS 4
  110. Perform the merge and commit the result\&. This option can be used to override \-\-no\-commit\&. Only useful when merging\&.
  111. .sp
  112. With \-\-no\-commit perform the merge and stop just before creating a merge commit, to give the user a chance to inspect and further tweak the merge result before committing\&.
  113. .sp
  114. Note that fast\-forward updates do not create a merge commit and therefore there is no way to stop those merges with \-\-no\-commit\&. Thus, if you want to ensure your branch is not changed or updated by the merge command, use \-\-no\-ff with \-\-no\-commit\&.
  115. .RE
  116. .PP
  117. \-\-edit, \-e, \-\-no\-edit
  118. .RS 4
  119. Invoke an editor before committing successful mechanical merge to further edit the auto\-generated merge message, so that the user can explain and justify the merge\&. The
  120. \fB\-\-no\-edit\fR
  121. option can be used to accept the auto\-generated message (this is generally discouraged)\&.
  122. .sp
  123. Older scripts may depend on the historical behaviour of not allowing the user to edit the merge log message\&. They will see an editor opened when they run
  124. \fBgit\fR
  125. \fBmerge\fR\&. To make it easier to adjust such scripts to the updated behaviour, the environment variable
  126. \fBGIT_MERGE_AUTOEDIT\fR
  127. can be set to
  128. \fBno\fR
  129. at the beginning of them\&.
  130. .RE
  131. .PP
  132. \-\-cleanup=<mode>
  133. .RS 4
  134. This option determines how the merge message will be cleaned up before committing\&. See
  135. \fBgit-commit\fR(1)
  136. for more details\&. In addition, if the
  137. \fI<mode>\fR
  138. is given a value of
  139. \fBscissors\fR, scissors will be appended to
  140. \fBMERGE_MSG\fR
  141. before being passed on to the commit machinery in the case of a merge conflict\&.
  142. .RE
  143. .PP
  144. \-\-ff\-only
  145. .RS 4
  146. Only update to the new history if there is no divergent local history\&. This is the default when no method for reconciling divergent histories is provided (via the \-\-rebase=* flags)\&.
  147. .RE
  148. .PP
  149. \-\-ff, \-\-no\-ff
  150. .RS 4
  151. When merging rather than rebasing, specifies how a merge is handled when the merged\-in history is already a descendant of the current history\&. If merging is requested,
  152. \fB\-\-ff\fR
  153. is the default unless merging an annotated (and possibly signed) tag that is not stored in its natural place in the
  154. \fBrefs/tags/\fR
  155. hierarchy, in which case
  156. \fB\-\-no\-ff\fR
  157. is assumed\&.
  158. .sp
  159. With
  160. \fB\-\-ff\fR, when possible resolve the merge as a fast\-forward (only update the branch pointer to match the merged branch; do not create a merge commit)\&. When not possible (when the merged\-in history is not a descendant of the current history), create a merge commit\&.
  161. .sp
  162. With
  163. \fB\-\-no\-ff\fR, create a merge commit in all cases, even when the merge could instead be resolved as a fast\-forward\&.
  164. .RE
  165. .PP
  166. \-S[<keyid>], \-\-gpg\-sign[=<keyid>], \-\-no\-gpg\-sign
  167. .RS 4
  168. GPG\-sign the resulting merge commit\&. The
  169. \fBkeyid\fR
  170. argument is optional and defaults to the committer identity; if specified, it must be stuck to the option without a space\&.
  171. \fB\-\-no\-gpg\-sign\fR
  172. is useful to countermand both
  173. \fBcommit\&.gpgSign\fR
  174. configuration variable, and earlier
  175. \fB\-\-gpg\-sign\fR\&.
  176. .RE
  177. .PP
  178. \-\-log[=<n>], \-\-no\-log
  179. .RS 4
  180. In addition to branch names, populate the log message with one\-line descriptions from at most <n> actual commits that are being merged\&. See also
  181. \fBgit-fmt-merge-msg\fR(1)\&. Only useful when merging\&.
  182. .sp
  183. With \-\-no\-log do not list one\-line descriptions from the actual commits being merged\&.
  184. .RE
  185. .PP
  186. \fB\-\-signoff\fR, \fB\-\-no\-signoff\fR
  187. .RS 4
  188. Add a
  189. \fBSigned\-off\-by\fR
  190. trailer by the committer at the end of the commit log message\&. The meaning of a signoff depends on the project to which you\(cqre committing\&. For example, it may certify that the committer has the rights to submit the work under the project\(cqs license or agrees to some contributor representation, such as a Developer Certificate of Origin\&. (See
  191. \m[blue]\fBhttps://developercertificate\&.org\fR\m[]
  192. for the one used by the Linux kernel and Git projects\&.) Consult the documentation or leadership of the project to which you\(cqre contributing to understand how the signoffs are used in that project\&.
  193. .sp
  194. The
  195. \fB\-\-no\-signoff\fR
  196. option can be used to countermand an earlier
  197. \fB\-\-signoff\fR
  198. option on the command line\&.
  199. .RE
  200. .PP
  201. \-\-stat, \-n, \-\-no\-stat
  202. .RS 4
  203. Show a diffstat at the end of the merge\&. The diffstat is also controlled by the configuration option merge\&.stat\&.
  204. .sp
  205. With \-n or \-\-no\-stat do not show a diffstat at the end of the merge\&.
  206. .RE
  207. .PP
  208. \-\-squash, \-\-no\-squash
  209. .RS 4
  210. Produce the working tree and index state as if a real merge happened (except for the merge information), but do not actually make a commit, move the
  211. \fBHEAD\fR, or record
  212. \fB$GIT_DIR/MERGE_HEAD\fR
  213. (to cause the next
  214. \fBgit\fR
  215. \fBcommit\fR
  216. command to create a merge commit)\&. This allows you to create a single commit on top of the current branch whose effect is the same as merging another branch (or more in case of an octopus)\&.
  217. .sp
  218. With \-\-no\-squash perform the merge and commit the result\&. This option can be used to override \-\-squash\&.
  219. .sp
  220. With \-\-squash, \-\-commit is not allowed, and will fail\&.
  221. .sp
  222. Only useful when merging\&.
  223. .RE
  224. .PP
  225. \-\-[no\-]verify
  226. .RS 4
  227. By default, the pre\-merge and commit\-msg hooks are run\&. When
  228. \fB\-\-no\-verify\fR
  229. is given, these are bypassed\&. See also
  230. \fBgithooks\fR(5)\&. Only useful when merging\&.
  231. .RE
  232. .PP
  233. \-s <strategy>, \-\-strategy=<strategy>
  234. .RS 4
  235. Use the given merge strategy; can be supplied more than once to specify them in the order they should be tried\&. If there is no
  236. \fB\-s\fR
  237. option, a built\-in list of strategies is used instead (\fBort\fR
  238. when merging a single head,
  239. \fBoctopus\fR
  240. otherwise)\&.
  241. .RE
  242. .PP
  243. \-X <option>, \-\-strategy\-option=<option>
  244. .RS 4
  245. Pass merge strategy specific option through to the merge strategy\&.
  246. .RE
  247. .PP
  248. \-\-verify\-signatures, \-\-no\-verify\-signatures
  249. .RS 4
  250. Verify that the tip commit of the side branch being merged is signed with a valid key, i\&.e\&. a key that has a valid uid: in the default trust model, this means the signing key has been signed by a trusted key\&. If the tip commit of the side branch is not signed with a valid key, the merge is aborted\&.
  251. .sp
  252. Only useful when merging\&.
  253. .RE
  254. .PP
  255. \-\-summary, \-\-no\-summary
  256. .RS 4
  257. Synonyms to \-\-stat and \-\-no\-stat; these are deprecated and will be removed in the future\&.
  258. .RE
  259. .PP
  260. \-\-autostash, \-\-no\-autostash
  261. .RS 4
  262. Automatically create a temporary stash entry before the operation begins, record it in the ref
  263. \fBMERGE_AUTOSTASH\fR
  264. and apply it after the operation ends\&. This means that you can run the operation on a dirty worktree\&. However, use with care: the final stash application after a successful merge might result in non\-trivial conflicts\&.
  265. .RE
  266. .PP
  267. \-\-allow\-unrelated\-histories
  268. .RS 4
  269. By default,
  270. \fBgit\fR
  271. \fBmerge\fR
  272. command refuses to merge histories that do not share a common ancestor\&. This option can be used to override this safety when merging histories of two projects that started their lives independently\&. As that is a very rare occasion, no configuration variable to enable this by default exists and will not be added\&.
  273. .sp
  274. Only useful when merging\&.
  275. .RE
  276. .PP
  277. \-r, \-\-rebase[=(false|true|merges|interactive)]
  278. .RS 4
  279. When true, rebase the current branch on top of the upstream branch after fetching\&. If there is a remote\-tracking branch corresponding to the upstream branch and the upstream branch was rebased since last fetched, the rebase uses that information to avoid rebasing non\-local changes\&.
  280. .sp
  281. When set to
  282. \fBmerges\fR, rebase using
  283. \fBgit\fR
  284. \fBrebase\fR
  285. \fB\-\-rebase\-merges\fR
  286. so that the local merge commits are included in the rebase (see
  287. \fBgit-rebase\fR(1)
  288. for details)\&.
  289. .sp
  290. When false, merge the upstream branch into the current branch\&.
  291. .sp
  292. When
  293. \fBinteractive\fR, enable the interactive mode of rebase\&.
  294. .sp
  295. See
  296. \fBpull\&.rebase\fR,
  297. \fBbranch\&.\fR\fI<name>\fR\fB\&.rebase\fR
  298. and
  299. \fBbranch\&.autoSetupRebase\fR
  300. in
  301. \fBgit-config\fR(1)
  302. if you want to make
  303. \fBgit\fR
  304. \fBpull\fR
  305. always use
  306. \fB\-\-rebase\fR
  307. instead of merging\&.
  308. .if n \{\
  309. .sp
  310. .\}
  311. .RS 4
  312. .it 1 an-trap
  313. .nr an-no-space-flag 1
  314. .nr an-break-flag 1
  315. .br
  316. .ps +1
  317. \fBNote\fR
  318. .ps -1
  319. .br
  320. This is a potentially
  321. \fIdangerous\fR
  322. mode of operation\&. It rewrites history, which does not bode well when you published that history already\&. Do
  323. \fBnot\fR
  324. use this option unless you have read
  325. \fBgit-rebase\fR(1)
  326. carefully\&.
  327. .sp .5v
  328. .RE
  329. .RE
  330. .PP
  331. \-\-no\-rebase
  332. .RS 4
  333. This is shorthand for \-\-rebase=false\&.
  334. .RE
  335. .SS "Options related to fetching"
  336. .PP
  337. \-\-[no\-]all
  338. .RS 4
  339. Fetch all remotes, except for the ones that has the
  340. \fBremote\&.\fR\fI<name>\fR\fB\&.skipFetchAll\fR
  341. configuration variable set\&. This overrides the configuration variable fetch\&.all`\&.
  342. .RE
  343. .PP
  344. \-a, \-\-append
  345. .RS 4
  346. Append ref names and object names of fetched refs to the existing contents of \&.\fBgit/FETCH_HEAD\fR\&. Without this option old data in \&.\fBgit/FETCH_HEAD\fR
  347. will be overwritten\&.
  348. .RE
  349. .PP
  350. \-\-atomic
  351. .RS 4
  352. Use an atomic transaction to update local refs\&. Either all refs are updated, or on error, no refs are updated\&.
  353. .RE
  354. .PP
  355. \-\-depth=<depth>
  356. .RS 4
  357. Limit fetching to the specified number of commits from the tip of each remote branch history\&. If fetching to a
  358. \fIshallow\fR
  359. repository created by
  360. \fBgit\fR
  361. \fBclone\fR
  362. with
  363. \fB\-\-depth=\fR\fI<depth>\fR
  364. option (see
  365. \fBgit-clone\fR(1)), deepen or shorten the history to the specified number of commits\&. Tags for the deepened commits are not fetched\&.
  366. .RE
  367. .PP
  368. \-\-deepen=<depth>
  369. .RS 4
  370. Similar to \-\-depth, except it specifies the number of commits from the current shallow boundary instead of from the tip of each remote branch history\&.
  371. .RE
  372. .PP
  373. \-\-shallow\-since=<date>
  374. .RS 4
  375. Deepen or shorten the history of a shallow repository to include all reachable commits after <date>\&.
  376. .RE
  377. .PP
  378. \-\-shallow\-exclude=<ref>
  379. .RS 4
  380. Deepen or shorten the history of a shallow repository to exclude commits reachable from a specified remote branch or tag\&. This option can be specified multiple times\&.
  381. .RE
  382. .PP
  383. \-\-unshallow
  384. .RS 4
  385. If the source repository is complete, convert a shallow repository to a complete one, removing all the limitations imposed by shallow repositories\&.
  386. .sp
  387. If the source repository is shallow, fetch as much as possible so that the current repository has the same history as the source repository\&.
  388. .RE
  389. .PP
  390. \-\-update\-shallow
  391. .RS 4
  392. By default when fetching from a shallow repository,
  393. \fBgit\fR
  394. \fBfetch\fR
  395. refuses refs that require updating \&.git/shallow\&. This option updates \&.git/shallow and accepts such refs\&.
  396. .RE
  397. .PP
  398. \-\-negotiation\-tip=<commit|glob>
  399. .RS 4
  400. By default, Git will report, to the server, commits reachable from all local refs to find common commits in an attempt to reduce the size of the to\-be\-received packfile\&. If specified, Git will only report commits reachable from the given tips\&. This is useful to speed up fetches when the user knows which local ref is likely to have commits in common with the upstream ref being fetched\&.
  401. .sp
  402. This option may be specified more than once; if so, Git will report commits reachable from any of the given commits\&.
  403. .sp
  404. The argument to this option may be a glob on ref names, a ref, or the (possibly abbreviated) SHA\-1 of a commit\&. Specifying a glob is equivalent to specifying this option multiple times, one for each matching ref name\&.
  405. .sp
  406. See also the
  407. \fBfetch\&.negotiationAlgorithm\fR
  408. and
  409. \fBpush\&.negotiate\fR
  410. configuration variables documented in
  411. \fBgit-config\fR(1), and the
  412. \fB\-\-negotiate\-only\fR
  413. option below\&.
  414. .RE
  415. .PP
  416. \-\-negotiate\-only
  417. .RS 4
  418. Do not fetch anything from the server, and instead print the ancestors of the provided
  419. \fB\-\-negotiation\-tip=\fR* arguments, which we have in common with the server\&.
  420. .sp
  421. This is incompatible with
  422. \fB\-\-recurse\-submodules=\fR[\fByes\fR|\fBon\-demand\fR]\&. Internally this is used to implement the
  423. \fBpush\&.negotiate\fR
  424. option, see
  425. \fBgit-config\fR(1)\&.
  426. .RE
  427. .PP
  428. \-\-dry\-run
  429. .RS 4
  430. Show what would be done, without making any changes\&.
  431. .RE
  432. .PP
  433. \-\-porcelain
  434. .RS 4
  435. Print the output to standard output in an easy\-to\-parse format for scripts\&. See section OUTPUT in
  436. \fBgit-fetch\fR(1)
  437. for details\&.
  438. .sp
  439. This is incompatible with
  440. \fB\-\-recurse\-submodules=\fR[\fByes\fR|\fBon\-demand\fR] and takes precedence over the
  441. \fBfetch\&.output\fR
  442. config option\&.
  443. .RE
  444. .PP
  445. \-f, \-\-force
  446. .RS 4
  447. When
  448. \fIgit fetch\fR
  449. is used with
  450. \fI<src>\fR\fB:\fR\fI<dst>\fR
  451. refspec, it may refuse to update the local branch as discussed in the
  452. \fI<refspec>\fR
  453. part of the
  454. \fBgit-fetch\fR(1)
  455. documentation\&. This option overrides that check\&.
  456. .RE
  457. .PP
  458. \-k, \-\-keep
  459. .RS 4
  460. Keep downloaded pack\&.
  461. .RE
  462. .PP
  463. \-\-prefetch
  464. .RS 4
  465. Modify the configured refspec to place all refs into the
  466. \fBrefs/prefetch/\fR
  467. namespace\&. See the
  468. \fBprefetch\fR
  469. task in
  470. \fBgit-maintenance\fR(1)\&.
  471. .RE
  472. .PP
  473. \-p, \-\-prune
  474. .RS 4
  475. Before fetching, remove any remote\-tracking references that no longer exist on the remote\&. Tags are not subject to pruning if they are fetched only because of the default tag auto\-following or due to a \-\-tags option\&. However, if tags are fetched due to an explicit refspec (either on the command line or in the remote configuration, for example if the remote was cloned with the \-\-mirror option), then they are also subject to pruning\&. Supplying
  476. \fB\-\-prune\-tags\fR
  477. is a shorthand for providing the tag refspec\&.
  478. .RE
  479. .PP
  480. \-\-no\-tags
  481. .RS 4
  482. By default, tags that point at objects that are downloaded from the remote repository are fetched and stored locally\&. This option disables this automatic tag following\&. The default behavior for a remote may be specified with the remote\&.<name>\&.tagOpt setting\&. See
  483. \fBgit-config\fR(1)\&.
  484. .RE
  485. .PP
  486. \-\-refmap=<refspec>
  487. .RS 4
  488. When fetching refs listed on the command line, use the specified refspec (can be given more than once) to map the refs to remote\-tracking branches, instead of the values of
  489. \fBremote\&.\fR*\&.\fBfetch\fR
  490. configuration variables for the remote repository\&. Providing an empty
  491. \fI<refspec>\fR
  492. to the
  493. \fB\-\-refmap\fR
  494. option causes Git to ignore the configured refspecs and rely entirely on the refspecs supplied as command\-line arguments\&. See section on "Configured Remote\-tracking Branches" for details\&.
  495. .RE
  496. .PP
  497. \-t, \-\-tags
  498. .RS 4
  499. Fetch all tags from the remote (i\&.e\&., fetch remote tags
  500. \fBrefs/tags/\fR* into local tags with the same name), in addition to whatever else would otherwise be fetched\&. Using this option alone does not subject tags to pruning, even if \-\-prune is used (though tags may be pruned anyway if they are also the destination of an explicit refspec; see
  501. \fB\-\-prune\fR)\&.
  502. .RE
  503. .PP
  504. \-j, \-\-jobs=<n>
  505. .RS 4
  506. Number of parallel children to be used for all forms of fetching\&.
  507. .sp
  508. If the
  509. \fB\-\-multiple\fR
  510. option was specified, the different remotes will be fetched in parallel\&. If multiple submodules are fetched, they will be fetched in parallel\&. To control them independently, use the config settings
  511. \fBfetch\&.parallel\fR
  512. and
  513. \fBsubmodule\&.fetchJobs\fR
  514. (see
  515. \fBgit-config\fR(1))\&.
  516. .sp
  517. Typically, parallel recursive and multi\-remote fetches will be faster\&. By default fetches are performed sequentially, not in parallel\&.
  518. .RE
  519. .PP
  520. \-\-set\-upstream
  521. .RS 4
  522. If the remote is fetched successfully, add upstream (tracking) reference, used by argument\-less
  523. \fBgit-pull\fR(1)
  524. and other commands\&. For more information, see
  525. \fBbranch\&.\fR\fI<name>\fR\fB\&.merge\fR
  526. and
  527. \fBbranch\&.\fR\fI<name>\fR\fB\&.remote\fR
  528. in
  529. \fBgit-config\fR(1)\&.
  530. .RE
  531. .PP
  532. \-\-upload\-pack <upload\-pack>
  533. .RS 4
  534. When given, and the repository to fetch from is handled by
  535. \fIgit fetch\-pack\fR,
  536. \fB\-\-exec=\fR\fI<upload\-pack>\fR
  537. is passed to the command to specify non\-default path for the command run on the other end\&.
  538. .RE
  539. .PP
  540. \-\-progress
  541. .RS 4
  542. Progress status is reported on the standard error stream by default when it is attached to a terminal, unless \-q is specified\&. This flag forces progress status even if the standard error stream is not directed to a terminal\&.
  543. .RE
  544. .PP
  545. \-o <option>, \-\-server\-option=<option>
  546. .RS 4
  547. Transmit the given string to the server when communicating using protocol version 2\&. The given string must not contain a NUL or LF character\&. The server\(cqs handling of server options, including unknown ones, is server\-specific\&. When multiple
  548. \fB\-\-server\-option=\fR\fI<option>\fR
  549. are given, they are all sent to the other side in the order listed on the command line\&. When no
  550. \fB\-\-server\-option=\fR\fI<option>\fR
  551. is given from the command line, the values of configuration variable
  552. \fBremote\&.\fR\fI<name>\fR\fB\&.serverOption\fR
  553. are used instead\&.
  554. .RE
  555. .PP
  556. \-\-show\-forced\-updates
  557. .RS 4
  558. By default, git checks if a branch is force\-updated during fetch\&. This can be disabled through fetch\&.showForcedUpdates, but the \-\-show\-forced\-updates option guarantees this check occurs\&. See
  559. \fBgit-config\fR(1)\&.
  560. .RE
  561. .PP
  562. \-\-no\-show\-forced\-updates
  563. .RS 4
  564. By default, git checks if a branch is force\-updated during fetch\&. Pass \-\-no\-show\-forced\-updates or set fetch\&.showForcedUpdates to false to skip this check for performance reasons\&. If used during
  565. \fIgit\-pull\fR
  566. the \-\-ff\-only option will still check for forced updates before attempting a fast\-forward update\&. See
  567. \fBgit-config\fR(1)\&.
  568. .RE
  569. .PP
  570. \-4, \-\-ipv4
  571. .RS 4
  572. Use IPv4 addresses only, ignoring IPv6 addresses\&.
  573. .RE
  574. .PP
  575. \-6, \-\-ipv6
  576. .RS 4
  577. Use IPv6 addresses only, ignoring IPv4 addresses\&.
  578. .RE
  579. .PP
  580. <repository>
  581. .RS 4
  582. The "remote" repository that is the source of a fetch or pull operation\&. This parameter can be either a URL (see the section
  583. GIT URLS
  584. below) or the name of a remote (see the section
  585. REMOTES
  586. below)\&.
  587. .RE
  588. .PP
  589. <refspec>
  590. .RS 4
  591. Specifies which refs to fetch and which local refs to update\&. When no <refspec>s appear on the command line, the refs to fetch are read from
  592. \fBremote\&.\fR\fI<repository>\fR\fB\&.fetch\fR
  593. variables instead (see the section "CONFIGURED REMOTE\-TRACKING BRANCHES" in
  594. \fBgit-fetch\fR(1))\&.
  595. .sp
  596. The format of a <refspec> parameter is an optional plus
  597. \fB+\fR, followed by the source <src>, followed by a colon
  598. \fB:\fR, followed by the destination <dst>\&. The colon can be omitted when <dst> is empty\&. <src> is typically a ref, or a glob pattern with a single * that is used to match a set of refs, but it can also be a fully spelled hex object name\&.
  599. .sp
  600. A <refspec> may contain a * in its <src> to indicate a simple pattern match\&. Such a refspec functions like a glob that matches any ref with the pattern\&. A pattern <refspec> must have one and only one * in both the <src> and <dst>\&. It will map refs to the destination by replacing the * with the contents matched from the source\&.
  601. .sp
  602. If a refspec is prefixed by
  603. \fB^\fR, it will be interpreted as a negative refspec\&. Rather than specifying which refs to fetch or which local refs to update, such a refspec will instead specify refs to exclude\&. A ref will be considered to match if it matches at least one positive refspec, and does not match any negative refspec\&. Negative refspecs can be useful to restrict the scope of a pattern refspec so that it will not include specific refs\&. Negative refspecs can themselves be pattern refspecs\&. However, they may only contain a <src> and do not specify a <dst>\&. Fully spelled out hex object names are also not supported\&.
  604. .sp
  605. \fBtag\fR
  606. \fI<tag>\fR
  607. means the same as
  608. \fBrefs/tags/\fR\fI<tag>\fR\fB:refs/tags/\fR\fI<tag>\fR; it requests fetching everything up to the given tag\&.
  609. .sp
  610. The remote ref that matches <src> is fetched, and if <dst> is not an empty string, an attempt is made to update the local ref that matches it\&.
  611. .sp
  612. Whether that update is allowed without
  613. \fB\-\-force\fR
  614. depends on the ref namespace it\(cqs being fetched to, the type of object being fetched, and whether the update is considered to be a fast\-forward\&. Generally, the same rules apply for fetching as when pushing, see the
  615. \fI<refspec>\fR\&.\&.\&. section of
  616. \fBgit-push\fR(1)
  617. for what those are\&. Exceptions to those rules particular to
  618. \fIgit fetch\fR
  619. are noted below\&.
  620. .sp
  621. Until Git version 2\&.20, and unlike when pushing with
  622. \fBgit-push\fR(1), any updates to
  623. \fBrefs/tags/\fR* would be accepted without
  624. \fB+\fR
  625. in the refspec (or
  626. \fB\-\-force\fR)\&. When fetching, we promiscuously considered all tag updates from a remote to be forced fetches\&. Since Git version 2\&.20, fetching to update
  627. \fBrefs/tags/\fR* works the same way as when pushing\&. I\&.e\&. any updates will be rejected without
  628. \fB+\fR
  629. in the refspec (or
  630. \fB\-\-force\fR)\&.
  631. .sp
  632. Unlike when pushing with
  633. \fBgit-push\fR(1), any updates outside of
  634. \fBrefs/\fR{tags,heads}/* will be accepted without
  635. \fB+\fR
  636. in the refspec (or
  637. \fB\-\-force\fR), whether that\(cqs swapping e\&.g\&. a tree object for a blob, or a commit for another commit that doesn\(cqt have the previous commit as an ancestor etc\&.
  638. .sp
  639. Unlike when pushing with
  640. \fBgit-push\fR(1), there is no configuration which\(cqll amend these rules, and nothing like a
  641. \fBpre\-fetch\fR
  642. hook analogous to the
  643. \fBpre\-receive\fR
  644. hook\&.
  645. .sp
  646. As with pushing with
  647. \fBgit-push\fR(1), all of the rules described above about what\(cqs not allowed as an update can be overridden by adding an optional leading
  648. \fB+\fR
  649. to a refspec (or using the
  650. \fB\-\-force\fR
  651. command line option)\&. The only exception to this is that no amount of forcing will make the
  652. \fBrefs/heads/\fR* namespace accept a non\-commit object\&.
  653. .if n \{\
  654. .sp
  655. .\}
  656. .RS 4
  657. .it 1 an-trap
  658. .nr an-no-space-flag 1
  659. .nr an-break-flag 1
  660. .br
  661. .ps +1
  662. \fBNote\fR
  663. .ps -1
  664. .br
  665. When the remote branch you want to fetch is known to be rewound and rebased regularly, it is expected that its new tip will not be a descendant of its previous tip (as stored in your remote\-tracking branch the last time you fetched)\&. You would want to use the
  666. \fB+\fR
  667. sign to indicate non\-fast\-forward updates will be needed for such branches\&. There is no way to determine or declare that a branch will be made available in a repository with this behavior; the pulling user simply must know this is the expected usage pattern for a branch\&.
  668. .sp .5v
  669. .RE
  670. .if n \{\
  671. .sp
  672. .\}
  673. .RS 4
  674. .it 1 an-trap
  675. .nr an-no-space-flag 1
  676. .nr an-break-flag 1
  677. .br
  678. .ps +1
  679. \fBNote\fR
  680. .ps -1
  681. .br
  682. There is a difference between listing multiple <refspec> directly on
  683. \fIgit pull\fR
  684. command line and having multiple
  685. \fBremote\&.\fR\fI<repository>\fR\fB\&.fetch\fR
  686. entries in your configuration for a <repository> and running a
  687. \fIgit pull\fR
  688. command without any explicit <refspec> parameters\&. <refspec>s listed explicitly on the command line are always merged into the current branch after fetching\&. In other words, if you list more than one remote ref,
  689. \fIgit pull\fR
  690. will create an Octopus merge\&. On the other hand, if you do not list any explicit <refspec> parameter on the command line,
  691. \fIgit pull\fR
  692. will fetch all the <refspec>s it finds in the
  693. \fBremote\&.\fR\fI<repository>\fR\fB\&.fetch\fR
  694. configuration and merge only the first <refspec> found into the current branch\&. This is because making an Octopus from remote refs is rarely done, while keeping track of multiple remote heads in one\-go by fetching more than one is often useful\&.
  695. .sp .5v
  696. .RE
  697. .RE
  698. .SH "GIT URLS"
  699. .sp
  700. In general, URLs contain information about the transport protocol, the address of the remote server, and the path to the repository\&. Depending on the transport protocol, some of this information may be absent\&.
  701. .sp
  702. Git supports ssh, git, http, and https protocols (in addition, ftp and ftps can be used for fetching, but this is inefficient and deprecated; do not use them)\&.
  703. .sp
  704. The native transport (i\&.e\&. \fBgit://\fR URL) does no authentication and should be used with caution on unsecured networks\&.
  705. .sp
  706. The following syntaxes may be used with them:
  707. .sp
  708. .RS 4
  709. .ie n \{\
  710. \h'-04'\(bu\h'+03'\c
  711. .\}
  712. .el \{\
  713. .sp -1
  714. .IP \(bu 2.3
  715. .\}
  716. \fBssh://\fR[\fI<user>\fR\fB@\fR]\fI<host>\fR[\fB:\fR\fI<port>\fR]\fB/\fR\fI<path\-to\-git\-repo>\fR
  717. .RE
  718. .sp
  719. .RS 4
  720. .ie n \{\
  721. \h'-04'\(bu\h'+03'\c
  722. .\}
  723. .el \{\
  724. .sp -1
  725. .IP \(bu 2.3
  726. .\}
  727. \fBgit://\fR\fI<host>\fR[\fB:\fR\fI<port>\fR]\fB/\fR\fI<path\-to\-git\-repo>\fR
  728. .RE
  729. .sp
  730. .RS 4
  731. .ie n \{\
  732. \h'-04'\(bu\h'+03'\c
  733. .\}
  734. .el \{\
  735. .sp -1
  736. .IP \(bu 2.3
  737. .\}
  738. \fBhttp\fR[\fBs\fR]\fB://\fR\fI<host>\fR[\fB:\fR\fI<port>\fR]\fB/\fR\fI<path\-to\-git\-repo>\fR
  739. .RE
  740. .sp
  741. .RS 4
  742. .ie n \{\
  743. \h'-04'\(bu\h'+03'\c
  744. .\}
  745. .el \{\
  746. .sp -1
  747. .IP \(bu 2.3
  748. .\}
  749. \fBftp\fR[\fBs\fR]\fB://\fR\fI<host>\fR[\fB:\fR\fI<port>\fR]\fB/\fR\fI<path\-to\-git\-repo>\fR
  750. .RE
  751. .sp
  752. An alternative scp\-like syntax may also be used with the ssh protocol:
  753. .sp
  754. .RS 4
  755. .ie n \{\
  756. \h'-04'\(bu\h'+03'\c
  757. .\}
  758. .el \{\
  759. .sp -1
  760. .IP \(bu 2.3
  761. .\}
  762. [\fI<user>\fR\fB@\fR]\fI<host>\fR\fB:/\fR\fI<path\-to\-git\-repo>\fR
  763. .RE
  764. .sp
  765. This syntax is only recognized if there are no slashes before the first colon\&. This helps differentiate a local path that contains a colon\&. For example the local path \fBfoo:bar\fR could be specified as an absolute path or \&.\fB/foo:bar\fR to avoid being misinterpreted as an ssh url\&.
  766. .sp
  767. The ssh and git protocols additionally support \fB~\fR\fI<username>\fR expansion:
  768. .sp
  769. .RS 4
  770. .ie n \{\
  771. \h'-04'\(bu\h'+03'\c
  772. .\}
  773. .el \{\
  774. .sp -1
  775. .IP \(bu 2.3
  776. .\}
  777. \fBssh://\fR[\fI<user>\fR\fB@\fR]\fI<host>\fR[\fB:\fR\fI<port>\fR]\fB/~\fR\fI<user>\fR\fB/\fR\fI<path\-to\-git\-repo>\fR
  778. .RE
  779. .sp
  780. .RS 4
  781. .ie n \{\
  782. \h'-04'\(bu\h'+03'\c
  783. .\}
  784. .el \{\
  785. .sp -1
  786. .IP \(bu 2.3
  787. .\}
  788. \fBgit://\fR\fI<host>\fR[\fB:\fR\fI<port>\fR]\fB/~\fR\fI<user>\fR\fB/\fR\fI<path\-to\-git\-repo>\fR
  789. .RE
  790. .sp
  791. .RS 4
  792. .ie n \{\
  793. \h'-04'\(bu\h'+03'\c
  794. .\}
  795. .el \{\
  796. .sp -1
  797. .IP \(bu 2.3
  798. .\}
  799. [\fI<user>\fR\fB@\fR]\fI<host>\fR\fB:~\fR\fI<user>\fR\fB/\fR\fI<path\-to\-git\-repo>\fR
  800. .RE
  801. .sp
  802. For local repositories, also supported by Git natively, the following syntaxes may be used:
  803. .sp
  804. .RS 4
  805. .ie n \{\
  806. \h'-04'\(bu\h'+03'\c
  807. .\}
  808. .el \{\
  809. .sp -1
  810. .IP \(bu 2.3
  811. .\}
  812. \fB/path/to/repo\&.git/\fR
  813. .RE
  814. .sp
  815. .RS 4
  816. .ie n \{\
  817. \h'-04'\(bu\h'+03'\c
  818. .\}
  819. .el \{\
  820. .sp -1
  821. .IP \(bu 2.3
  822. .\}
  823. \fBfile:///path/to/repo\&.git/\fR
  824. .RE
  825. .sp
  826. These two syntaxes are mostly equivalent, except when cloning, when the former implies \fB\-\-local\fR option\&. See \fBgit-clone\fR(1) for details\&.
  827. .sp
  828. \fBgit\fR \fBclone\fR, \fBgit\fR \fBfetch\fR and \fBgit\fR \fBpull\fR, but not \fBgit\fR \fBpush\fR, will also accept a suitable bundle file\&. See \fBgit-bundle\fR(1)\&.
  829. .sp
  830. When Git doesn\(cqt know how to handle a certain transport protocol, it attempts to use the \fBremote\-\fR\fI<transport>\fR remote helper, if one exists\&. To explicitly request a remote helper, the following syntax may be used:
  831. .sp
  832. .RS 4
  833. .ie n \{\
  834. \h'-04'\(bu\h'+03'\c
  835. .\}
  836. .el \{\
  837. .sp -1
  838. .IP \(bu 2.3
  839. .\}
  840. \fI<transport>\fR\fB::\fR\fI<address>\fR
  841. .RE
  842. .sp
  843. where \fI<address>\fR may be a path, a server and path, or an arbitrary URL\-like string recognized by the specific remote helper being invoked\&. See \fBgitremote-helpers\fR(7) for details\&.
  844. .sp
  845. If there are a large number of similarly\-named remote repositories and you want to use a different format for them (such that the URLs you use will be rewritten into URLs that work), you can create a configuration section of the form:
  846. .sp
  847. .if n \{\
  848. .RS 4
  849. .\}
  850. .nf
  851. [url "\fI<actual\-url\-base>\fR"]
  852. insteadOf = \fI<other\-url\-base>\fR
  853. .fi
  854. .if n \{\
  855. .RE
  856. .\}
  857. .sp
  858. For example, with this:
  859. .sp
  860. .if n \{\
  861. .RS 4
  862. .\}
  863. .nf
  864. [url "git://git\&.host\&.xz/"]
  865. insteadOf = host\&.xz:/path/to/
  866. insteadOf = work:
  867. .fi
  868. .if n \{\
  869. .RE
  870. .\}
  871. .sp
  872. a URL like "work:repo\&.git" or like "host\&.xz:/path/to/repo\&.git" will be rewritten in any context that takes a URL to be "git://git\&.host\&.xz/repo\&.git"\&.
  873. .sp
  874. If you want to rewrite URLs for push only, you can create a configuration section of the form:
  875. .sp
  876. .if n \{\
  877. .RS 4
  878. .\}
  879. .nf
  880. [url "\fI<actual\-url\-base>\fR"]
  881. pushInsteadOf = \fI<other\-url\-base>\fR
  882. .fi
  883. .if n \{\
  884. .RE
  885. .\}
  886. .sp
  887. For example, with this:
  888. .sp
  889. .if n \{\
  890. .RS 4
  891. .\}
  892. .nf
  893. [url "ssh://example\&.org/"]
  894. pushInsteadOf = git://example\&.org/
  895. .fi
  896. .if n \{\
  897. .RE
  898. .\}
  899. .sp
  900. a URL like "git://example\&.org/path/to/repo\&.git" will be rewritten to "ssh://example\&.org/path/to/repo\&.git" for pushes, but pulls will still use the original URL\&.
  901. .SH "REMOTES"
  902. .sp
  903. The name of one of the following can be used instead of a URL as \fI<repository>\fR argument:
  904. .sp
  905. .RS 4
  906. .ie n \{\
  907. \h'-04'\(bu\h'+03'\c
  908. .\}
  909. .el \{\
  910. .sp -1
  911. .IP \(bu 2.3
  912. .\}
  913. a remote in the Git configuration file:
  914. \fB$GIT_DIR/config\fR,
  915. .RE
  916. .sp
  917. .RS 4
  918. .ie n \{\
  919. \h'-04'\(bu\h'+03'\c
  920. .\}
  921. .el \{\
  922. .sp -1
  923. .IP \(bu 2.3
  924. .\}
  925. a file in the
  926. \fB$GIT_DIR/remotes\fR
  927. directory, or
  928. .RE
  929. .sp
  930. .RS 4
  931. .ie n \{\
  932. \h'-04'\(bu\h'+03'\c
  933. .\}
  934. .el \{\
  935. .sp -1
  936. .IP \(bu 2.3
  937. .\}
  938. a file in the
  939. \fB$GIT_DIR/branches\fR
  940. directory\&.
  941. .RE
  942. .sp
  943. All of these also allow you to omit the refspec from the command line because they each contain a refspec which git will use by default\&.
  944. .SS "Named remote in configuration file"
  945. .sp
  946. You can choose to provide the name of a remote which you had previously configured using \fBgit-remote\fR(1), \fBgit-config\fR(1) or even by a manual edit to the \fB$GIT_DIR/config\fR file\&. The URL of this remote will be used to access the repository\&. The refspec of this remote will be used by default when you do not provide a refspec on the command line\&. The entry in the config file would appear like this:
  947. .sp
  948. .if n \{\
  949. .RS 4
  950. .\}
  951. .nf
  952. [remote "<name>"]
  953. url = <URL>
  954. pushurl = <pushurl>
  955. push = <refspec>
  956. fetch = <refspec>
  957. .fi
  958. .if n \{\
  959. .RE
  960. .\}
  961. .sp
  962. The \fI<pushurl>\fR is used for pushes only\&. It is optional and defaults to \fI<URL>\fR\&. Pushing to a remote affects all defined pushurls or all defined urls if no pushurls are defined\&. Fetch, however, will only fetch from the first defined url if multiple urls are defined\&.
  963. .SS "Named file in \fB$GIT_DIR/remotes\fR"
  964. .sp
  965. You can choose to provide the name of a file in \fB$GIT_DIR/remotes\fR\&. The URL in this file will be used to access the repository\&. The refspec in this file will be used as default when you do not provide a refspec on the command line\&. This file should have the following format:
  966. .sp
  967. .if n \{\
  968. .RS 4
  969. .\}
  970. .nf
  971. URL: one of the above URL formats
  972. Push: <refspec>
  973. Pull: <refspec>
  974. .fi
  975. .if n \{\
  976. .RE
  977. .\}
  978. .sp
  979. \fBPush:\fR lines are used by \fIgit push\fR and \fBPull:\fR lines are used by \fIgit pull\fR and \fIgit fetch\fR\&. Multiple \fBPush:\fR and \fBPull:\fR lines may be specified for additional branch mappings\&.
  980. .SS "Named file in \fB$GIT_DIR/branches\fR"
  981. .sp
  982. You can choose to provide the name of a file in \fB$GIT_DIR/branches\fR\&. The URL in this file will be used to access the repository\&. This file should have the following format:
  983. .sp
  984. .if n \{\
  985. .RS 4
  986. .\}
  987. .nf
  988. <URL>#<head>
  989. .fi
  990. .if n \{\
  991. .RE
  992. .\}
  993. .sp
  994. \fI<URL>\fR is required; #\fI<head>\fR is optional\&.
  995. .sp
  996. Depending on the operation, git will use one of the following refspecs, if you don\(cqt provide one on the command line\&. \fI<branch>\fR is the name of this file in \fB$GIT_DIR/branches\fR and \fI<head>\fR defaults to \fBmaster\fR\&.
  997. .sp
  998. git fetch uses:
  999. .sp
  1000. .if n \{\
  1001. .RS 4
  1002. .\}
  1003. .nf
  1004. refs/heads/<head>:refs/heads/<branch>
  1005. .fi
  1006. .if n \{\
  1007. .RE
  1008. .\}
  1009. .sp
  1010. git push uses:
  1011. .sp
  1012. .if n \{\
  1013. .RS 4
  1014. .\}
  1015. .nf
  1016. HEAD:refs/heads/<head>
  1017. .fi
  1018. .if n \{\
  1019. .RE
  1020. .\}
  1021. .SH "MERGE STRATEGIES"
  1022. .sp
  1023. The merge mechanism (\fBgit\fR \fBmerge\fR and \fBgit\fR \fBpull\fR commands) allows the backend \fImerge strategies\fR to be chosen with \fB\-s\fR option\&. Some strategies can also take their own options, which can be passed by giving \fB\-X\fR\fI<option>\fR arguments to \fBgit\fR \fBmerge\fR and/or \fBgit\fR \fBpull\fR\&.
  1024. .PP
  1025. ort
  1026. .RS 4
  1027. This is the default merge strategy when pulling or merging one branch\&. This strategy can only resolve two heads using a 3\-way merge algorithm\&. When there is more than one common ancestor that can be used for 3\-way merge, it creates a merged tree of the common ancestors and uses that as the reference tree for the 3\-way merge\&. This has been reported to result in fewer merge conflicts without causing mismerges by tests done on actual merge commits taken from Linux 2\&.6 kernel development history\&. Additionally this strategy can detect and handle merges involving renames\&. It does not make use of detected copies\&. The name for this algorithm is an acronym ("Ostensibly Recursive\(cqs Twin") and came from the fact that it was written as a replacement for the previous default algorithm,
  1028. \fBrecursive\fR\&.
  1029. .sp
  1030. In the case where the path is a submodule, if the submodule commit used on one side of the merge is a descendant of the submodule commit used on the other side of the merge, Git attempts to fast\-forward to the descendant\&. Otherwise, Git will treat this case as a conflict, suggesting as a resolution a submodule commit that is descendant of the conflicting ones, if one exists\&.
  1031. .sp
  1032. The
  1033. \fIort\fR
  1034. strategy can take the following options:
  1035. .PP
  1036. ours
  1037. .RS 4
  1038. This option forces conflicting hunks to be auto\-resolved cleanly by favoring
  1039. \fIour\fR
  1040. version\&. Changes from the other tree that do not conflict with our side are reflected in the merge result\&. For a binary file, the entire contents are taken from our side\&.
  1041. .sp
  1042. This should not be confused with the
  1043. \fIours\fR
  1044. merge strategy, which does not even look at what the other tree contains at all\&. It discards everything the other tree did, declaring
  1045. \fIour\fR
  1046. history contains all that happened in it\&.
  1047. .RE
  1048. .PP
  1049. theirs
  1050. .RS 4
  1051. This is the opposite of
  1052. \fIours\fR; note that, unlike
  1053. \fIours\fR, there is no
  1054. \fItheirs\fR
  1055. merge strategy to confuse this merge option with\&.
  1056. .RE
  1057. .PP
  1058. ignore\-space\-change, ignore\-all\-space, ignore\-space\-at\-eol, ignore\-cr\-at\-eol
  1059. .RS 4
  1060. Treats lines with the indicated type of whitespace change as unchanged for the sake of a three\-way merge\&. Whitespace changes mixed with other changes to a line are not ignored\&. See also
  1061. \fBgit-diff\fR(1)
  1062. \fB\-b\fR,
  1063. \fB\-w\fR,
  1064. \fB\-\-ignore\-space\-at\-eol\fR, and
  1065. \fB\-\-ignore\-cr\-at\-eol\fR\&.
  1066. .sp
  1067. .RS 4
  1068. .ie n \{\
  1069. \h'-04'\(bu\h'+03'\c
  1070. .\}
  1071. .el \{\
  1072. .sp -1
  1073. .IP \(bu 2.3
  1074. .\}
  1075. If
  1076. \fItheir\fR
  1077. version only introduces whitespace changes to a line,
  1078. \fIour\fR
  1079. version is used;
  1080. .RE
  1081. .sp
  1082. .RS 4
  1083. .ie n \{\
  1084. \h'-04'\(bu\h'+03'\c
  1085. .\}
  1086. .el \{\
  1087. .sp -1
  1088. .IP \(bu 2.3
  1089. .\}
  1090. If
  1091. \fIour\fR
  1092. version introduces whitespace changes but
  1093. \fItheir\fR
  1094. version includes a substantial change,
  1095. \fItheir\fR
  1096. version is used;
  1097. .RE
  1098. .sp
  1099. .RS 4
  1100. .ie n \{\
  1101. \h'-04'\(bu\h'+03'\c
  1102. .\}
  1103. .el \{\
  1104. .sp -1
  1105. .IP \(bu 2.3
  1106. .\}
  1107. Otherwise, the merge proceeds in the usual way\&.
  1108. .RE
  1109. .RE
  1110. .PP
  1111. renormalize
  1112. .RS 4
  1113. This runs a virtual check\-out and check\-in of all three stages of any file which needs a three\-way merge\&. This option is meant to be used when merging branches with different clean filters or end\-of\-line normalization rules\&. See "Merging branches with differing checkin/checkout attributes" in
  1114. \fBgitattributes\fR(5)
  1115. for details\&.
  1116. .RE
  1117. .PP
  1118. no\-renormalize
  1119. .RS 4
  1120. Disables the
  1121. \fBrenormalize\fR
  1122. option\&. This overrides the
  1123. \fBmerge\&.renormalize\fR
  1124. configuration variable\&.
  1125. .RE
  1126. .PP
  1127. find\-renames[=<n>]
  1128. .RS 4
  1129. Turn on rename detection, optionally setting the similarity threshold\&. This is the default\&. This overrides the
  1130. \fImerge\&.renames\fR
  1131. configuration variable\&. See also
  1132. \fBgit-diff\fR(1)
  1133. \fB\-\-find\-renames\fR\&.
  1134. .RE
  1135. .PP
  1136. rename\-threshold=<n>
  1137. .RS 4
  1138. Deprecated synonym for
  1139. \fBfind\-renames=\fR\fI<n>\fR\&.
  1140. .RE
  1141. .PP
  1142. subtree[=<path>]
  1143. .RS 4
  1144. This option is a more advanced form of
  1145. \fIsubtree\fR
  1146. strategy, where the strategy makes a guess on how two trees must be shifted to match with each other when merging\&. Instead, the specified path is prefixed (or stripped from the beginning) to make the shape of two trees to match\&.
  1147. .RE
  1148. .RE
  1149. .PP
  1150. recursive
  1151. .RS 4
  1152. This can only resolve two heads using a 3\-way merge algorithm\&. When there is more than one common ancestor that can be used for 3\-way merge, it creates a merged tree of the common ancestors and uses that as the reference tree for the 3\-way merge\&. This has been reported to result in fewer merge conflicts without causing mismerges by tests done on actual merge commits taken from Linux 2\&.6 kernel development history\&. Additionally this can detect and handle merges involving renames\&. It does not make use of detected copies\&. This was the default strategy for resolving two heads from Git v0\&.99\&.9k until v2\&.33\&.0\&.
  1153. .sp
  1154. For a path that is a submodule, the same caution as
  1155. \fIort\fR
  1156. applies to this strategy\&.
  1157. .sp
  1158. The
  1159. \fIrecursive\fR
  1160. strategy takes the same options as
  1161. \fIort\fR\&. However, there are three additional options that
  1162. \fIort\fR
  1163. ignores (not documented above) that are potentially useful with the
  1164. \fIrecursive\fR
  1165. strategy:
  1166. .PP
  1167. patience
  1168. .RS 4
  1169. Deprecated synonym for
  1170. \fBdiff\-algorithm=patience\fR\&.
  1171. .RE
  1172. .PP
  1173. diff\-algorithm=[patience|minimal|histogram|myers]
  1174. .RS 4
  1175. Use a different diff algorithm while merging, which can help avoid mismerges that occur due to unimportant matching lines (such as braces from distinct functions)\&. See also
  1176. \fBgit-diff\fR(1)
  1177. \fB\-\-diff\-algorithm\fR\&. Note that
  1178. \fBort\fR
  1179. specifically uses
  1180. \fBdiff\-algorithm=histogram\fR, while
  1181. \fBrecursive\fR
  1182. defaults to the
  1183. \fBdiff\&.algorithm\fR
  1184. config setting\&.
  1185. .RE
  1186. .PP
  1187. no\-renames
  1188. .RS 4
  1189. Turn off rename detection\&. This overrides the
  1190. \fBmerge\&.renames\fR
  1191. configuration variable\&. See also
  1192. \fBgit-diff\fR(1)
  1193. \fB\-\-no\-renames\fR\&.
  1194. .RE
  1195. .RE
  1196. .PP
  1197. resolve
  1198. .RS 4
  1199. This can only resolve two heads (i\&.e\&. the current branch and another branch you pulled from) using a 3\-way merge algorithm\&. It tries to carefully detect criss\-cross merge ambiguities\&. It does not handle renames\&.
  1200. .RE
  1201. .PP
  1202. octopus
  1203. .RS 4
  1204. This resolves cases with more than two heads, but refuses to do a complex merge that needs manual resolution\&. It is primarily meant to be used for bundling topic branch heads together\&. This is the default merge strategy when pulling or merging more than one branch\&.
  1205. .RE
  1206. .PP
  1207. ours
  1208. .RS 4
  1209. This resolves any number of heads, but the resulting tree of the merge is always that of the current branch head, effectively ignoring all changes from all other branches\&. It is meant to be used to supersede old development history of side branches\&. Note that this is different from the \-Xours option to the
  1210. \fIrecursive\fR
  1211. merge strategy\&.
  1212. .RE
  1213. .PP
  1214. subtree
  1215. .RS 4
  1216. This is a modified
  1217. \fBort\fR
  1218. strategy\&. When merging trees A and B, if B corresponds to a subtree of A, B is first adjusted to match the tree structure of A, instead of reading the trees at the same level\&. This adjustment is also done to the common ancestor tree\&.
  1219. .RE
  1220. .sp
  1221. With the strategies that use 3\-way merge (including the default, \fIort\fR), if a change is made on both branches, but later reverted on one of the branches, that change will be present in the merged result; some people find this behavior confusing\&. It occurs because only the heads and the merge base are considered when performing a merge, not the individual commits\&. The merge algorithm therefore considers the reverted change as no change at all, and substitutes the changed version instead\&.
  1222. .SH "DEFAULT BEHAVIOUR"
  1223. .sp
  1224. Often people use \fBgit\fR \fBpull\fR without giving any parameter\&. Traditionally, this has been equivalent to saying \fBgit\fR \fBpull\fR \fBorigin\fR\&. However, when configuration \fBbranch\&.\fR\fI<name>\fR\fB\&.remote\fR is present while on branch \fI<name>\fR, that value is used instead of \fBorigin\fR\&.
  1225. .sp
  1226. In order to determine what URL to use to fetch from, the value of the configuration \fBremote\&.\fR\fI<origin>\fR\fB\&.url\fR is consulted and if there is not any such variable, the value on the \fBURL:\fR line in \fB$GIT_DIR/remotes/\fR\fI<origin>\fR is used\&.
  1227. .sp
  1228. In order to determine what remote branches to fetch (and optionally store in the remote\-tracking branches) when the command is run without any refspec parameters on the command line, values of the configuration variable \fBremote\&.\fR\fI<origin>\fR\fB\&.fetch\fR are consulted, and if there aren\(cqt any, \fB$GIT_DIR/remotes/\fR\fI<origin>\fR is consulted and its \fBPull:\fR lines are used\&. In addition to the refspec formats described in the OPTIONS section, you can have a globbing refspec that looks like this:
  1229. .sp
  1230. .if n \{\
  1231. .RS 4
  1232. .\}
  1233. .nf
  1234. refs/heads/*:refs/remotes/origin/*
  1235. .fi
  1236. .if n \{\
  1237. .RE
  1238. .\}
  1239. .sp
  1240. A globbing refspec must have a non\-empty RHS (i\&.e\&. must store what were fetched in remote\-tracking branches), and its LHS and RHS must end with \fB/\fR*\&. The above specifies that all remote branches are tracked using remote\-tracking branches in \fBrefs/remotes/origin/\fR hierarchy under the same name\&.
  1241. .sp
  1242. The rule to determine which remote branch to merge after fetching is a bit involved, in order not to break backward compatibility\&.
  1243. .sp
  1244. If explicit refspecs were given on the command line of \fBgit\fR \fBpull\fR, they are all merged\&.
  1245. .sp
  1246. When no refspec was given on the command line, then \fBgit\fR \fBpull\fR uses the refspec from the configuration or \fB$GIT_DIR/remotes/\fR\fI<origin>\fR\&. In such cases, the following rules apply:
  1247. .sp
  1248. .RS 4
  1249. .ie n \{\
  1250. \h'-04' 1.\h'+01'\c
  1251. .\}
  1252. .el \{\
  1253. .sp -1
  1254. .IP " 1." 4.2
  1255. .\}
  1256. If
  1257. \fBbranch\&.\fR\fI<name>\fR\fB\&.merge\fR
  1258. configuration for the current branch
  1259. \fI<name>\fR
  1260. exists, that is the name of the branch at the remote site that is merged\&.
  1261. .RE
  1262. .sp
  1263. .RS 4
  1264. .ie n \{\
  1265. \h'-04' 2.\h'+01'\c
  1266. .\}
  1267. .el \{\
  1268. .sp -1
  1269. .IP " 2." 4.2
  1270. .\}
  1271. If the refspec is a globbing one, nothing is merged\&.
  1272. .RE
  1273. .sp
  1274. .RS 4
  1275. .ie n \{\
  1276. \h'-04' 3.\h'+01'\c
  1277. .\}
  1278. .el \{\
  1279. .sp -1
  1280. .IP " 3." 4.2
  1281. .\}
  1282. Otherwise the remote branch of the first refspec is merged\&.
  1283. .RE
  1284. .SH "EXAMPLES"
  1285. .sp
  1286. .RS 4
  1287. .ie n \{\
  1288. \h'-04'\(bu\h'+03'\c
  1289. .\}
  1290. .el \{\
  1291. .sp -1
  1292. .IP \(bu 2.3
  1293. .\}
  1294. Update the remote\-tracking branches for the repository you cloned from, then merge one of them into your current branch:
  1295. .sp
  1296. .if n \{\
  1297. .RS 4
  1298. .\}
  1299. .nf
  1300. $ git pull
  1301. $ git pull origin
  1302. .fi
  1303. .if n \{\
  1304. .RE
  1305. .\}
  1306. .sp
  1307. Normally the branch merged in is the HEAD of the remote repository, but the choice is determined by the branch\&.<name>\&.remote and branch\&.<name>\&.merge options; see
  1308. \fBgit-config\fR(1)
  1309. for details\&.
  1310. .RE
  1311. .sp
  1312. .RS 4
  1313. .ie n \{\
  1314. \h'-04'\(bu\h'+03'\c
  1315. .\}
  1316. .el \{\
  1317. .sp -1
  1318. .IP \(bu 2.3
  1319. .\}
  1320. Merge into the current branch the remote branch
  1321. \fBnext\fR:
  1322. .sp
  1323. .if n \{\
  1324. .RS 4
  1325. .\}
  1326. .nf
  1327. $ git pull origin next
  1328. .fi
  1329. .if n \{\
  1330. .RE
  1331. .\}
  1332. .sp
  1333. This leaves a copy of
  1334. \fBnext\fR
  1335. temporarily in FETCH_HEAD, and updates the remote\-tracking branch
  1336. \fBorigin/next\fR\&. The same can be done by invoking fetch and merge:
  1337. .sp
  1338. .if n \{\
  1339. .RS 4
  1340. .\}
  1341. .nf
  1342. $ git fetch origin
  1343. $ git merge origin/next
  1344. .fi
  1345. .if n \{\
  1346. .RE
  1347. .\}
  1348. .RE
  1349. .sp
  1350. If you tried a pull which resulted in complex conflicts and would want to start over, you can recover with \fIgit reset\fR\&.
  1351. .SH "SECURITY"
  1352. .sp
  1353. The fetch and push protocols are not designed to prevent one side from stealing data from the other repository that was not intended to be shared\&. If you have private data that you need to protect from a malicious peer, your best option is to store it in another repository\&. This applies to both clients and servers\&. In particular, namespaces on a server are not effective for read access control; you should only grant read access to a namespace to clients that you would trust with read access to the entire repository\&.
  1354. .sp
  1355. The known attack vectors are as follows:
  1356. .sp
  1357. .RS 4
  1358. .ie n \{\
  1359. \h'-04' 1.\h'+01'\c
  1360. .\}
  1361. .el \{\
  1362. .sp -1
  1363. .IP " 1." 4.2
  1364. .\}
  1365. The victim sends "have" lines advertising the IDs of objects it has that are not explicitly intended to be shared but can be used to optimize the transfer if the peer also has them\&. The attacker chooses an object ID X to steal and sends a ref to X, but isn\(cqt required to send the content of X because the victim already has it\&. Now the victim believes that the attacker has X, and it sends the content of X back to the attacker later\&. (This attack is most straightforward for a client to perform on a server, by creating a ref to X in the namespace the client has access to and then fetching it\&. The most likely way for a server to perform it on a client is to "merge" X into a public branch and hope that the user does additional work on this branch and pushes it back to the server without noticing the merge\&.)
  1366. .RE
  1367. .sp
  1368. .RS 4
  1369. .ie n \{\
  1370. \h'-04' 2.\h'+01'\c
  1371. .\}
  1372. .el \{\
  1373. .sp -1
  1374. .IP " 2." 4.2
  1375. .\}
  1376. As in #1, the attacker chooses an object ID X to steal\&. The victim sends an object Y that the attacker already has, and the attacker falsely claims to have X and not Y, so the victim sends Y as a delta against X\&. The delta reveals regions of X that are similar to Y to the attacker\&.
  1377. .RE
  1378. .SH "BUGS"
  1379. .sp
  1380. Using \-\-recurse\-submodules can only fetch new commits in already checked out submodules right now\&. When e\&.g\&. upstream added a new submodule in the just fetched commits of the superproject the submodule itself cannot be fetched, making it impossible to check out that submodule later without having to do a fetch again\&. This is expected to be fixed in a future Git version\&.
  1381. .SH "SEE ALSO"
  1382. .sp
  1383. \fBgit-fetch\fR(1), \fBgit-merge\fR(1), \fBgit-config\fR(1)
  1384. .SH "GIT"
  1385. .sp
  1386. Part of the \fBgit\fR(1) suite