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