Raw
1 `--all`::
2 `--no-all`::
3 Fetch all remotes, except for the ones that have the
4 `remote.<name>.skipFetchAll` configuration variable set.
5 This overrides the configuration variable `fetch.all`.
6
7 `-a`::
8 `--append`::
9 Append ref names and object names of fetched refs to the
10 existing contents of `.git/FETCH_HEAD`. Without this
11 option old data in `.git/FETCH_HEAD` will be overwritten.
12
13 `--atomic`::
14 Use an atomic transaction to update local refs. Either all refs are
15 updated, or on error, no refs are updated.
16
17 `--depth=<depth>`::
18 Limit fetching to the specified number of commits from the tip of
19 each remote branch history. If fetching to a 'shallow' repository
20 created by `git clone` with `--depth=<depth>` option (see
21 linkgit:git-clone[1]), deepen or shorten the history to the specified
22 number of commits. Tags for the deepened commits are not fetched.
23
24 `--deepen=<depth>`::
25 Similar to `--depth`, except it specifies the number of commits
26 from the current shallow boundary instead of from the tip of
27 each remote branch history.
28
29 `--shallow-since=<date>`::
30 Deepen or shorten the history of a shallow repository to
31 include all reachable commits after _<date>_.
32
33 `--shallow-exclude=<ref>`::
34 Deepen or shorten the history of a shallow repository to
35 exclude commits reachable from a specified remote branch or tag.
36 This option can be specified multiple times.
37
38 `--unshallow`::
39 If the source repository is complete, convert a shallow
40 repository to a complete one, removing all the limitations
41 imposed by shallow repositories.
42 +
43 If the source repository is shallow, fetch as much as possible so that
44 the current repository has the same history as the source repository.
45
46 `--update-shallow`::
47 By default when fetching from a shallow repository,
48 `git fetch` refuses refs that require updating
49 `.git/shallow`. This option updates `.git/shallow` and accepts such
50 refs.
51
52 `--negotiation-restrict=(<commit>|<glob>)`::
53 `--negotiation-tip=(<commit>|<glob>)`::
54 By default, Git will report, to the server, commits reachable
55 from all local refs to find common commits in an attempt to
56 reduce the size of the to-be-received packfile. If specified,
57 Git will only report commits reachable from the given tips.
58 This is useful to speed up fetches when the user knows which
59 local ref is likely to have commits in common with the
60 upstream ref being fetched.
61 +
62 `--negotiation-restrict` is the preferred name for this option;
63 `--negotiation-tip` is accepted as a synonym.
64 +
65 This option may be specified more than once; if so, Git will report
66 commits reachable from any of the given commits.
67 +
68 The argument to this option may be a glob on ref names, a ref, or the (possibly
69 abbreviated) SHA-1 of a commit. Specifying a glob is equivalent to specifying
70 this option multiple times, one for each matching ref name.
71 +
72 See also the `fetch.negotiationAlgorithm` and `push.negotiate`
73 configuration variables documented in linkgit:git-config[1], and the
74 `--negotiate-only` option below.
75
76 `--negotiation-include=(<commit>|<glob>)`::
77 Ensure that the commits at the given tips are always sent as "have"
78 lines during fetch negotiation, regardless of what the negotiation
79 algorithm selects. This is useful to guarantee that common
80 history reachable from specific refs is always considered, even
81 when `--negotiation-restrict` restricts the set of tips or when
82 the negotiation algorithm would otherwise skip them.
83 +
84 This option may be specified more than once; if so, each commit is sent
85 unconditionally.
86 +
87 The argument may be an exact ref name (e.g. `refs/heads/release`), an
88 object hash, or a glob pattern (e.g. `refs/heads/release/{asterisk}`).
89 The pattern syntax is the same as for `--negotiation-restrict`.
90 +
91 If `--negotiation-restrict` is used, the have set is first restricted by
92 that option and then increased to include the tips specified by
93 `--negotiation-include`.
94 +
95 If this option is not specified on the command line, then any
96 `remote.<name>.negotiationInclude` config values for the current remote
97 are used instead.
98
99 `--negotiate-only`::
100 Do not fetch anything from the server, and instead print the
101 ancestors of the provided `--negotiation-restrict=` arguments,
102 which we have in common with the server.
103 +
104 This is incompatible with `--recurse-submodules=(yes|on-demand)`.
105 Internally this is used to implement the `push.negotiate` option, see
106 linkgit:git-config[1].
107
108 `--dry-run`::
109 Show what would be done, without making any changes.
110
111 `--porcelain`::
112 Print the output to standard output in an easy-to-parse format for
113 scripts. See section OUTPUT in linkgit:git-fetch[1] for details.
114 +
115 This is incompatible with `--recurse-submodules=(yes|on-demand)` and takes
116 precedence over the `fetch.output` config option.
117
118 `--filter=<filter-spec>`::
119 Use the partial clone feature and request that the server sends
120 a subset of reachable objects according to a given object filter.
121 When using `--filter`, the supplied _<filter-spec>_ is used for
122 the partial fetch.
123 +
124 If `--filter=auto` is used, the filter specification is determined
125 automatically by combining the filter specifications advertised by
126 the server for the promisor remotes that the client accepts (see
127 linkgit:gitprotocol-v2[5] and the `promisor.acceptFromServer`
128 configuration option in linkgit:git-config[1]).
129 +
130 For details on all other available filter specifications, see the
131 `--filter=<filter-spec>` option in linkgit:git-rev-list[1].
132 +
133 For example, `--filter=blob:none` will filter out all blobs (file
134 contents) until needed by Git. Also, `--filter=blob:limit=<size>` will
135 filter out all blobs of size at least _<size>_.
136
137 ifndef::git-pull[]
138 `--write-fetch-head`::
139 `--no-write-fetch-head`::
140 Write the list of remote refs fetched in the `FETCH_HEAD`
141 file directly under `$GIT_DIR`. This is the default.
142 Passing `--no-write-fetch-head` from the command line tells
143 Git not to write the file. Under `--dry-run` option, the
144 file is never written.
145 endif::git-pull[]
146
147 `-f`::
148 `--force`::
149 ifdef::git-pull[]
150 When `git fetch` is used with `<src>:<dst>` refspec, it may
151 refuse to update the local branch as discussed
152 in the _<refspec>_ part of the linkgit:git-fetch[1]
153 documentation.
154 endif::git-pull[]
155 ifndef::git-pull[]
156 When `git fetch` is used with `<src>:<dst>` refspec, it may
157 refuse to update the local branch as discussed in the _<refspec>_ part below.
158 endif::git-pull[]
159 This option overrides that check.
160
161 `-k`::
162 `--keep`::
163 Keep downloaded pack.
164
165 ifndef::git-pull[]
166 `--multiple`::
167 Allow several _<repository>_ and _<group>_ arguments to be
168 specified. No __<refspec>__s may be specified.
169
170 `--auto-maintenance`::
171 `--no-auto-maintenance`::
172 `--auto-gc`::
173 `--no-auto-gc`::
174 Run `git maintenance run --auto` at the end to perform automatic
175 repository maintenance if needed.
176 This is enabled by default.
177
178 `--write-commit-graph`::
179 `--no-write-commit-graph`::
180 Write a commit-graph after fetching. This overrides the config
181 setting `fetch.writeCommitGraph`.
182 endif::git-pull[]
183
184 `--prefetch`::
185 Modify the configured refspec to place all refs into the
186 `refs/prefetch/` namespace. See the `prefetch` task in
187 linkgit:git-maintenance[1].
188
189 `-p`::
190 `--prune`::
191 Before fetching, remove any remote-tracking references that no
192 longer exist on the remote. Tags are not subject to pruning
193 if they are fetched only because of the default tag
194 auto-following or due to a `--tags` option. However, if tags
195 are fetched due to an explicit refspec (either on the command
196 line or in the remote configuration, for example if the remote
197 was cloned with the `--mirror` option), then they are also
198 subject to pruning. Supplying `--prune-tags` is a shorthand for
199 providing the tag refspec.
200 ifndef::git-pull[]
201 +
202 See the PRUNING section below for more details.
203
204 `-P`::
205 `--prune-tags`::
206 Before fetching, remove any local tags that no longer exist on
207 the remote if `--prune` is enabled. This option should be used
208 more carefully, unlike `--prune` it will remove any local
209 references (local tags) that have been created. This option is
210 a shorthand for providing the explicit tag refspec along with
211 `--prune`, see the discussion about that in its documentation.
212 +
213 See the PRUNING section below for more details.
214
215 endif::git-pull[]
216
217 ifndef::git-pull[]
218 `-n`::
219 endif::git-pull[]
220 `--no-tags`::
221 By default, tags that point at objects that are downloaded
222 from the remote repository are fetched and stored locally.
223 This option disables this automatic tag following. The default
224 behavior for a remote may be specified with the `remote.<name>.tagOpt`
225 setting. See linkgit:git-config[1].
226
227 ifndef::git-pull[]
228 `--refetch`::
229 Instead of negotiating with the server to avoid transferring commits and
230 associated objects that are already present locally, this option fetches
231 all objects as a fresh clone would. Use this to reapply a partial clone
232 filter from configuration or using `--filter=` when the filter
233 definition has changed. Automatic post-fetch maintenance will perform
234 object database pack consolidation to remove any duplicate objects.
235 endif::git-pull[]
236
237 `--refmap=<refspec>`::
238 When fetching refs listed on the command line, use the
239 specified refspec (can be given more than once) to map the
240 refs to remote-tracking branches, instead of the values of
241 `remote.<name>.fetch` configuration variables for the remote
242 repository. Providing an empty _<refspec>_ to the
243 `--refmap` option causes Git to ignore the configured
244 refspecs and rely entirely on the refspecs supplied as
245 command-line arguments. See section on "Configured Remote-tracking
246 Branches" for details.
247
248 `-t`::
249 `--tags`::
250 Fetch all tags from the remote (i.e., fetch remote tags
251 `refs/tags/*` into local tags with the same name), in addition
252 to whatever else would otherwise be fetched. Using this
253 option alone does not subject tags to pruning, even if `--prune`
254 is used (though tags may be pruned anyway if they are also the
255 destination of an explicit refspec; see `--prune`).
256
257 ifndef::git-pull[]
258 `--recurse-submodules[=(yes|on-demand|no)]`::
259 Control if and under what conditions new commits of
260 submodules should be fetched too. When recursing through submodules,
261 `git fetch` always attempts to fetch "changed" submodules, that is, a
262 submodule that has commits that are referenced by a newly fetched
263 superproject commit but are missing in the local submodule clone. A
264 changed submodule can be fetched as long as it is present locally e.g.
265 in `$GIT_DIR/modules/` (see linkgit:gitsubmodules[7]); if the upstream
266 adds a new submodule, that submodule cannot be fetched until it is
267 cloned e.g. by `git submodule update`.
268 +
269 When set to `on-demand`, only changed submodules are fetched. When set
270 to `yes`, all populated submodules are fetched and submodules that are
271 both unpopulated and changed are fetched. When set to `no`, submodules
272 are never fetched.
273 +
274 When unspecified, this uses the value of `fetch.recurseSubmodules` if it
275 is set (see linkgit:git-config[1]), defaulting to `on-demand` if unset.
276 When this option is used without any value, it defaults to `yes`.
277 endif::git-pull[]
278
279 `-j <n>`::
280 `--jobs=<n>`::
281 Parallelize all forms of fetching up to _<n>_ jobs at a time.
282 +
283 A value of 0 will use some reasonable default.
284 +
285 If the `--multiple` option was specified, the different remotes will be fetched
286 in parallel. If multiple submodules are fetched, they will be fetched in
287 parallel. To control them independently, use the config settings
288 `fetch.parallel` and `submodule.fetchJobs` (see linkgit:git-config[1]).
289 +
290 Typically, parallel recursive and multi-remote fetches will be faster. By
291 default fetches are performed sequentially, not in parallel.
292
293 ifndef::git-pull[]
294 `--no-recurse-submodules`::
295 Disable recursive fetching of submodules (this has the same effect as
296 using the `--recurse-submodules=no` option).
297
298 `--submodule-errors=(fail|warn)`::
299 Control how errors from submodule fetches are handled when
300 `--recurse-submodules` is in effect. When set to `fail` (the default),
301 any submodule fetch error causes the overall `git fetch` to exit with a
302 non-zero status. When set to `warn`, submodule fetch errors are reported
303 to standard error but do not affect the exit status of the command. Can
304 also be configured via `fetch.submoduleErrors`. See linkgit:git-config[1].
305 endif::git-pull[]
306
307 `--set-upstream`::
308 If the remote is fetched successfully, add upstream
309 (tracking) reference, used by argument-less
310 linkgit:git-pull[1] and other commands. For more information,
311 see `branch.<name>.merge` and `branch.<name>.remote` in
312 linkgit:git-config[1].
313
314 ifndef::git-pull[]
315 `--submodule-prefix=<path>`::
316 Prepend _<path>_ to paths printed in informative messages
317 such as "Fetching submodule foo". This option is used
318 internally when recursing over submodules.
319
320 `--recurse-submodules-default=(yes|on-demand)`::
321 This option is used internally to temporarily provide a
322 non-negative default value for the `--recurse-submodules`
323 option. All other methods of configuring fetch's submodule
324 recursion (such as settings in linkgit:gitmodules[5] and
325 linkgit:git-config[1]) override this option, as does
326 specifying `--[no-]recurse-submodules` directly.
327
328 `-u`::
329 `--update-head-ok`::
330 By default `git fetch` refuses to update the head which
331 corresponds to the current branch. This flag disables the
332 check. This is purely for the internal use for `git pull`
333 to communicate with `git fetch`, and unless you are
334 implementing your own Porcelain you are not supposed to
335 use it.
336 endif::git-pull[]
337
338 `--upload-pack <upload-pack>`::
339 When given, and the repository to fetch from is handled
340 by `git fetch-pack`, `--exec=<upload-pack>` is passed to
341 the command to specify non-default path for the command
342 run on the other end.
343
344 ifndef::git-pull[]
345 `-q`::
346 `--quiet`::
347 Pass `--quiet` to `git-fetch-pack` and silence any other internally
348 used git commands. Progress is not reported to the standard error
349 stream.
350
351 `-v`::
352 `--verbose`::
353 Be verbose.
354 endif::git-pull[]
355
356 `--progress`::
357 Progress status is reported on the standard error stream
358 by default when it is attached to a terminal, unless `-q`
359 is specified. This flag forces progress status even if the
360 standard error stream is not directed to a terminal.
361
362 `-o <option>`::
363 `--server-option=<option>`::
364 Transmit the given string to the server when communicating using
365 protocol version 2. The given string must not contain a _NUL_ or _LF_
366 character. The server's handling of server options, including
367 unknown ones, is server-specific.
368 When multiple `--server-option=<option>` are given, they are all
369 sent to the other side in the order listed on the command line.
370 When no `--server-option=<option>` is given from the command line,
371 the values of configuration variable `remote.<name>.serverOption`
372 are used instead.
373
374 `--show-forced-updates`::
375 By default, git checks if a branch is force-updated during
376 fetch. This can be disabled through `fetch.showForcedUpdates`, but
377 the `--show-forced-updates` option guarantees this check occurs.
378 See linkgit:git-config[1].
379
380 `--no-show-forced-updates`::
381 By default, git checks if a branch is force-updated during
382 fetch. Pass `--no-show-forced-updates` or set `fetch.showForcedUpdates`
383 to false to skip this check for performance reasons. If used during
384 `git-pull` the `--ff-only` option will still check for forced updates
385 before attempting a fast-forward update. See linkgit:git-config[1].
386
387 `-4`::
388 `--ipv4`::
389 Use IPv4 addresses only, ignoring IPv6 addresses.
390
391 `-6`::
392 `--ipv6`::
393 Use IPv6 addresses only, ignoring IPv4 addresses.