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