]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/fetch-options.txt
Merge branch 'ps/pack-refs-auto' into jt/reftable-geometric-compaction
[thirdparty/git.git] / Documentation / fetch-options.txt
CommitLineData
39487a15
TB
1--[no-]all::
2 Fetch all remotes. This overrides the configuration variable
3 `fetch.all`.
9c4a036b 4
3240240f
SB
5-a::
6--append::
93d69d86
JL
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
c7b190da
PS
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
6b276e19 15--depth=<depth>::
60253a60
SS
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.
2c620a1a 21
cccf74e2
NTND
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
508ea882
NTND
27--shallow-since=<date>::
28 Deepen or shorten the history of a shallow repository to
29 include all reachable commits after <date>.
30
a45a2600
NTND
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
4dcb167f 36--unshallow::
79d3a236
NTND
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+
41If the source repository is shallow, fetch as much as possible so that
42the current repository has the same history as the source repository.
4dcb167f 43
48d25cae
NTND
44--update-shallow::
45 By default when fetching from a shallow repository,
46 `git fetch` refuses refs that require updating
ce14cc0b 47 .git/shallow. This option updates .git/shallow and accepts such
48d25cae 48 refs.
4dcb167f 49
3390e42a
JT
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+
59This option may be specified more than once; if so, Git will report
60commits reachable from any of the given commits.
61+
62The argument to this option may be a glob on ref names, a ref, or the (possibly
63abbreviated) SHA-1 of a commit. Specifying a glob is equivalent to specifying
64this option multiple times, one for each matching ref name.
52660828 65+
60fadf8b
ÆAB
66See also the `fetch.negotiationAlgorithm` and `push.negotiate`
67configuration 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+
386c076a 75This is incompatible with `--recurse-submodules=[yes|on-demand]`.
60fadf8b
ÆAB
76Internally this is used to implement the `push.negotiate` option, see
77linkgit:git-config[1].
3390e42a 78
28a15401
JS
79--dry-run::
80 Show what would be done, without making any changes.
28a15401 81
dd781e38
PS
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+
86This is incompatible with `--recurse-submodules=[yes|on-demand]` and takes
87precedence over the `fetch.output` config option.
88
887952b8
JH
89ifndef::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.
96endif::git-pull[]
97
3240240f
SB
98-f::
99--force::
4d542687 100 When 'git fetch' is used with `<src>:<dst>` refspec, it may
ae6a4703
ÆAB
101 refuse to update the local branch as discussed
102ifdef::git-pull[]
103 in the `<refspec>` part of the linkgit:git-fetch[1]
104 documentation.
105endif::git-pull[]
106ifndef::git-pull[]
107 in the `<refspec>` part below.
108endif::git-pull[]
109 This option overrides that check.
93d69d86 110
6b276e19
JA
111-k::
112--keep::
113 Keep downloaded pack.
114
16679e37
BG
115ifndef::git-pull[]
116--multiple::
117 Allow several <repository> and <group> arguments to be
118 specified. No <refspec>s may be specified.
f360d844 119
a95ce124 120--[no-]auto-maintenance::
c3d6b703 121--[no-]auto-gc::
a95ce124
DS
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.
c3d6b703 125
c14e6e79
JS
126--[no-]write-commit-graph::
127 Write a commit-graph after fetching. This overrides the config
128 setting `fetch.writeCommitGraph`.
9c688735 129endif::git-pull[]
c14e6e79 130
2e03115d
DS
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
1b79d1c2 136-p::
f360d844 137--prune::
9e70233a 138 Before fetching, remove any remote-tracking references that no
0838bf47
MH
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
97716d21
ÆAB
145 subject to pruning. Supplying `--prune-tags` is a shorthand for
146 providing the tag refspec.
9c688735 147ifndef::git-pull[]
97716d21
ÆAB
148+
149See 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.
627a129b
ÆAB
159+
160See the PRUNING section below for more details.
161
16679e37
BG
162endif::git-pull[]
163
10eb64f5 164ifndef::git-pull[]
3240240f 165-n::
10eb64f5 166endif::git-pull[]
01ca90c2 167--no-tags::
10eb64f5
MV
168 By default, tags that point at objects that are downloaded
169 from the remote repository are fetched and stored locally.
ed368546 170 This option disables this automatic tag following. The default
da0005b8 171 behavior for a remote may be specified with the remote.<name>.tagOpt
ed368546 172 setting. See linkgit:git-config[1].
03febf99 173
3c7bab06
RC
174ifndef::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
7390f05a
RC
180 definition has changed. Automatic post-fetch maintenance will perform
181 object database pack consolidation to remove any duplicate objects.
3c7bab06
RC
182endif::git-pull[]
183
c5558f80
JH
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
b40a5026
DS
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
c5558f80
JH
193 Branches" for details.
194
3240240f
SB
195-t::
196--tags::
0838bf47
MH
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
bcf9626a 202 destination of an explicit refspec; see `--prune`).
93d69d86 203
9c688735 204ifndef::git-pull[]
0620ae0f 205--recurse-submodules[=(yes|on-demand|no)]::
8f0700dd 206 This option controls if and under what conditions new commits of
b90d9f76
GC
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+
216When set to 'on-demand', only changed submodules are fetched. When set
217to 'yes', all populated submodules are fetched and submodules that are
218both unpopulated and changed are fetched. When set to 'no', submodules
219are never fetched.
220+
221When unspecified, this uses the value of `fetch.recurseSubmodules` if it
222is set (see linkgit:git-config[1]), defaulting to 'on-demand' if unset.
223When this option is used without any value, it defaults to 'yes'.
9c688735 224endif::git-pull[]
8f0700dd 225
62104ba1
SB
226-j::
227--jobs=<n>::
d54dea77
JS
228 Number of parallel children to be used for all forms of fetching.
229+
230If the `--multiple` option was specified, the different remotes will be fetched
231in parallel. If multiple submodules are fetched, they will be fetched in
232parallel. To control them independently, use the config settings
233`fetch.parallel` and `submodule.fetchJobs` (see linkgit:git-config[1]).
234+
235Typically, parallel recursive and multi-remote fetches will be faster. By
236default fetches are performed sequentially, not in parallel.
62104ba1 237
9c688735 238ifndef::git-pull[]
8f0700dd
JL
239--no-recurse-submodules::
240 Disable recursive fetching of submodules (this has the same effect as
bcf9626a 241 using the `--recurse-submodules=no` option).
9c688735 242endif::git-pull[]
7dce19d3 243
24bc1a12 244--set-upstream::
847b3727 245 If the remote is fetched successfully, add upstream
24bc1a12
CB
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
9c688735 251ifndef::git-pull[]
7dce19d3
JL
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.
88a21979
JL
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.
93d69d86 264
3240240f
SB
265-u::
266--update-head-ok::
0b444cdb 267 By default 'git fetch' refuses to update the head which
93d69d86 268 corresponds to the current branch. This flag disables the
0b444cdb
TR
269 check. This is purely for the internal use for 'git pull'
270 to communicate with 'git fetch', and unless you are
a597fb0e
JH
271 implementing your own Porcelain you are not supposed to
272 use it.
f05558f3 273endif::git-pull[]
03febf99 274
6b276e19
JA
275--upload-pack <upload-pack>::
276 When given, and the repository to fetch from is handled
bcf9626a 277 by 'git fetch-pack', `--exec=<upload-pack>` is passed to
6b276e19
JA
278 the command to specify non-default path for the command
279 run on the other end.
280
281ifndef::git-pull[]
282-q::
283--quiet::
284 Pass --quiet to git-fetch-pack and silence any other internally
9839018e
TRC
285 used git commands. Progress is not reported to the standard error
286 stream.
6b276e19
JA
287
288-v::
289--verbose::
290 Be verbose.
291endif::git-pull[]
9839018e
TRC
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.
c915f11e 298
5e3548ef
BW
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
6e983059
JT
303 character. The server's handling of server options, including
304 unknown ones, is server-specific.
5e3548ef
BW
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
cdbd70c4
DS
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
c915f11e
EW
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.