Git fork
1--all::
2--no-all::
3 Fetch all remotes, except for the ones that has 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+
43If the source repository is shallow, fetch as much as possible so that
44the 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-tip=<commit|glob>::
53 By default, Git will report, to the server, commits reachable
54 from all local refs to find common commits in an attempt to
55 reduce the size of the to-be-received packfile. If specified,
56 Git will only report commits reachable from the given tips.
57 This is useful to speed up fetches when the user knows which
58 local ref is likely to have commits in common with the
59 upstream ref being fetched.
60+
61This option may be specified more than once; if so, Git will report
62commits reachable from any of the given commits.
63+
64The argument to this option may be a glob on ref names, a ref, or the (possibly
65abbreviated) SHA-1 of a commit. Specifying a glob is equivalent to specifying
66this option multiple times, one for each matching ref name.
67+
68See also the `fetch.negotiationAlgorithm` and `push.negotiate`
69configuration variables documented in linkgit:git-config[1], and the
70`--negotiate-only` option below.
71
72--negotiate-only::
73 Do not fetch anything from the server, and instead print the
74 ancestors of the provided `--negotiation-tip=*` arguments,
75 which we have in common with the server.
76+
77This is incompatible with `--recurse-submodules=[yes|on-demand]`.
78Internally this is used to implement the `push.negotiate` option, see
79linkgit:git-config[1].
80
81--dry-run::
82 Show what would be done, without making any changes.
83
84--porcelain::
85 Print the output to standard output in an easy-to-parse format for
86 scripts. See section OUTPUT in linkgit:git-fetch[1] for details.
87+
88This is incompatible with `--recurse-submodules=[yes|on-demand]` and takes
89precedence over the `fetch.output` config option.
90
91ifndef::git-pull[]
92--write-fetch-head::
93--no-write-fetch-head::
94 Write the list of remote refs fetched in the `FETCH_HEAD`
95 file directly under `$GIT_DIR`. This is the default.
96 Passing `--no-write-fetch-head` from the command line tells
97 Git not to write the file. Under `--dry-run` option, the
98 file is never written.
99endif::git-pull[]
100
101-f::
102--force::
103 When 'git fetch' is used with `<src>:<dst>` refspec, it may
104 refuse to update the local branch as discussed
105ifdef::git-pull[]
106 in the `<refspec>` part of the linkgit:git-fetch[1]
107 documentation.
108endif::git-pull[]
109ifndef::git-pull[]
110 in the `<refspec>` part below.
111endif::git-pull[]
112 This option overrides that check.
113
114-k::
115--keep::
116 Keep downloaded pack.
117
118ifndef::git-pull[]
119--multiple::
120 Allow several <repository> and <group> arguments to be
121 specified. No <refspec>s may be specified.
122
123--auto-maintenance::
124--no-auto-maintenance::
125--auto-gc::
126--no-auto-gc::
127 Run `git maintenance run --auto` at the end to perform automatic
128 repository maintenance if needed. (`--[no-]auto-gc` is a synonym.)
129 This is enabled by default.
130
131--write-commit-graph::
132--no-write-commit-graph::
133 Write a commit-graph after fetching. This overrides the config
134 setting `fetch.writeCommitGraph`.
135endif::git-pull[]
136
137--prefetch::
138 Modify the configured refspec to place all refs into the
139 `refs/prefetch/` namespace. See the `prefetch` task in
140 linkgit:git-maintenance[1].
141
142-p::
143--prune::
144 Before fetching, remove any remote-tracking references that no
145 longer exist on the remote. Tags are not subject to pruning
146 if they are fetched only because of the default tag
147 auto-following or due to a --tags option. However, if tags
148 are fetched due to an explicit refspec (either on the command
149 line or in the remote configuration, for example if the remote
150 was cloned with the --mirror option), then they are also
151 subject to pruning. Supplying `--prune-tags` is a shorthand for
152 providing the tag refspec.
153ifndef::git-pull[]
154+
155See the PRUNING section below for more details.
156
157-P::
158--prune-tags::
159 Before fetching, remove any local tags that no longer exist on
160 the remote if `--prune` is enabled. This option should be used
161 more carefully, unlike `--prune` it will remove any local
162 references (local tags) that have been created. This option is
163 a shorthand for providing the explicit tag refspec along with
164 `--prune`, see the discussion about that in its documentation.
165+
166See the PRUNING section below for more details.
167
168endif::git-pull[]
169
170ifndef::git-pull[]
171-n::
172endif::git-pull[]
173--no-tags::
174 By default, tags that point at objects that are downloaded
175 from the remote repository are fetched and stored locally.
176 This option disables this automatic tag following. The default
177 behavior for a remote may be specified with the remote.<name>.tagOpt
178 setting. See linkgit:git-config[1].
179
180ifndef::git-pull[]
181--refetch::
182 Instead of negotiating with the server to avoid transferring commits and
183 associated objects that are already present locally, this option fetches
184 all objects as a fresh clone would. Use this to reapply a partial clone
185 filter from configuration or using `--filter=` when the filter
186 definition has changed. Automatic post-fetch maintenance will perform
187 object database pack consolidation to remove any duplicate objects.
188endif::git-pull[]
189
190--refmap=<refspec>::
191 When fetching refs listed on the command line, use the
192 specified refspec (can be given more than once) to map the
193 refs to remote-tracking branches, instead of the values of
194 `remote.*.fetch` configuration variables for the remote
195 repository. Providing an empty `<refspec>` to the
196 `--refmap` option causes Git to ignore the configured
197 refspecs and rely entirely on the refspecs supplied as
198 command-line arguments. See section on "Configured Remote-tracking
199 Branches" for details.
200
201-t::
202--tags::
203 Fetch all tags from the remote (i.e., fetch remote tags
204 `refs/tags/*` into local tags with the same name), in addition
205 to whatever else would otherwise be fetched. Using this
206 option alone does not subject tags to pruning, even if --prune
207 is used (though tags may be pruned anyway if they are also the
208 destination of an explicit refspec; see `--prune`).
209
210ifndef::git-pull[]
211--recurse-submodules[=(yes|on-demand|no)]::
212 This option controls if and under what conditions new commits of
213 submodules should be fetched too. When recursing through submodules,
214 `git fetch` always attempts to fetch "changed" submodules, that is, a
215 submodule that has commits that are referenced by a newly fetched
216 superproject commit but are missing in the local submodule clone. A
217 changed submodule can be fetched as long as it is present locally e.g.
218 in `$GIT_DIR/modules/` (see linkgit:gitsubmodules[7]); if the upstream
219 adds a new submodule, that submodule cannot be fetched until it is
220 cloned e.g. by `git submodule update`.
221+
222When set to 'on-demand', only changed submodules are fetched. When set
223to 'yes', all populated submodules are fetched and submodules that are
224both unpopulated and changed are fetched. When set to 'no', submodules
225are never fetched.
226+
227When unspecified, this uses the value of `fetch.recurseSubmodules` if it
228is set (see linkgit:git-config[1]), defaulting to 'on-demand' if unset.
229When this option is used without any value, it defaults to 'yes'.
230endif::git-pull[]
231
232-j::
233--jobs=<n>::
234 Number of parallel children to be used for all forms of fetching.
235+
236If the `--multiple` option was specified, the different remotes will be fetched
237in parallel. If multiple submodules are fetched, they will be fetched in
238parallel. To control them independently, use the config settings
239`fetch.parallel` and `submodule.fetchJobs` (see linkgit:git-config[1]).
240+
241Typically, parallel recursive and multi-remote fetches will be faster. By
242default fetches are performed sequentially, not in parallel.
243
244ifndef::git-pull[]
245--no-recurse-submodules::
246 Disable recursive fetching of submodules (this has the same effect as
247 using the `--recurse-submodules=no` option).
248endif::git-pull[]
249
250--set-upstream::
251 If the remote is fetched successfully, add upstream
252 (tracking) reference, used by argument-less
253 linkgit:git-pull[1] and other commands. For more information,
254 see `branch.<name>.merge` and `branch.<name>.remote` in
255 linkgit:git-config[1].
256
257ifndef::git-pull[]
258--submodule-prefix=<path>::
259 Prepend <path> to paths printed in informative messages
260 such as "Fetching submodule foo". This option is used
261 internally when recursing over submodules.
262
263--recurse-submodules-default=[yes|on-demand]::
264 This option is used internally to temporarily provide a
265 non-negative default value for the --recurse-submodules
266 option. All other methods of configuring fetch's submodule
267 recursion (such as settings in linkgit:gitmodules[5] and
268 linkgit:git-config[1]) override this option, as does
269 specifying --[no-]recurse-submodules directly.
270
271-u::
272--update-head-ok::
273 By default 'git fetch' refuses to update the head which
274 corresponds to the current branch. This flag disables the
275 check. This is purely for the internal use for 'git pull'
276 to communicate with 'git fetch', and unless you are
277 implementing your own Porcelain you are not supposed to
278 use it.
279endif::git-pull[]
280
281--upload-pack <upload-pack>::
282 When given, and the repository to fetch from is handled
283 by 'git fetch-pack', `--exec=<upload-pack>` is passed to
284 the command to specify non-default path for the command
285 run on the other end.
286
287ifndef::git-pull[]
288-q::
289--quiet::
290 Pass --quiet to git-fetch-pack and silence any other internally
291 used git commands. Progress is not reported to the standard error
292 stream.
293
294-v::
295--verbose::
296 Be verbose.
297endif::git-pull[]
298
299--progress::
300 Progress status is reported on the standard error stream
301 by default when it is attached to a terminal, unless -q
302 is specified. This flag forces progress status even if the
303 standard error stream is not directed to a terminal.
304
305-o <option>::
306--server-option=<option>::
307 Transmit the given string to the server when communicating using
308 protocol version 2. The given string must not contain a NUL or LF
309 character. The server's handling of server options, including
310 unknown ones, is server-specific.
311 When multiple `--server-option=<option>` are given, they are all
312 sent to the other side in the order listed on the command line.
313 When no `--server-option=<option>` is given from the command line,
314 the values of configuration variable `remote.<name>.serverOption`
315 are used instead.
316
317--show-forced-updates::
318 By default, git checks if a branch is force-updated during
319 fetch. This can be disabled through fetch.showForcedUpdates, but
320 the --show-forced-updates option guarantees this check occurs.
321 See linkgit:git-config[1].
322
323--no-show-forced-updates::
324 By default, git checks if a branch is force-updated during
325 fetch. Pass --no-show-forced-updates or set fetch.showForcedUpdates
326 to false to skip this check for performance reasons. If used during
327 'git-pull' the --ff-only option will still check for forced updates
328 before attempting a fast-forward update. See linkgit:git-config[1].
329
330-4::
331--ipv4::
332 Use IPv4 addresses only, ignoring IPv6 addresses.
333
334-6::
335--ipv6::
336 Use IPv6 addresses only, ignoring IPv4 addresses.