blob: 622bd84768b056e23fa0f432e745aaffd651c734 [file] [log] [blame]
Björn Gustavsson9c4a0362009-11-09 21:09:56 +01001--all::
2 Fetch all remotes.
3
Stephan Beyer32402402008-06-08 03:36:09 +02004-a::
5--append::
Jon Loeliger93d69d82005-11-06 23:30:56 -06006 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
Patrick Steinhardtc7b190d2021-01-12 13:27:52 +010010--atomic::
11 Use an atomic transaction to update local refs. Either all refs are
12 updated, or on error, no refs are updated.
13
Jari Aalto6b276e12009-10-21 23:07:49 +030014--depth=<depth>::
Sebastian Schuberth60253a62016-01-08 10:32:52 +010015 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.
Michal Ostrowski2c620a12006-01-20 13:05:24 -050020
Nguyễn Thái Ngọc Duycccf74e2016-06-12 17:54:09 +070021--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
Nguyễn Thái Ngọc Duy508ea882016-06-12 17:53:59 +070026--shallow-since=<date>::
27 Deepen or shorten the history of a shallow repository to
28 include all reachable commits after <date>.
29
Nguyễn Thái Ngọc Duya45a2602016-06-12 17:54:04 +070030--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
Nguyễn Thái Ngọc Duy4dcb1672013-01-11 16:05:46 +070035--unshallow::
Nguyễn Thái Ngọc Duy79d3a232013-12-05 20:02:41 +070036 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+
40If the source repository is shallow, fetch as much as possible so that
41the current repository has the same history as the source repository.
Nguyễn Thái Ngọc Duy4dcb1672013-01-11 16:05:46 +070042
Nguyễn Thái Ngọc Duy48d25ca2013-12-05 20:02:42 +070043--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.
Jay Soffian28a15402009-11-10 09:19:43 +010048
Jonathan Tan3390e422018-07-02 15:39:44 -070049--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+
58This option may be specified more than once; if so, Git will report
59commits reachable from any of the given commits.
60+
61The argument to this option may be a glob on ref names, a ref, or the (possibly
62abbreviated) SHA-1 of a commit. Specifying a glob is equivalent to specifying
63this option multiple times, one for each matching ref name.
Ævar Arnfjörð Bjarmason52660822018-08-01 15:18:35 +000064+
Ævar Arnfjörð Bjarmason60fadf82021-06-30 18:38:11 +020065See also the `fetch.negotiationAlgorithm` and `push.negotiate`
66configuration 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+
Glen Choo386c0762022-01-18 16:00:56 -080074This is incompatible with `--recurse-submodules=[yes|on-demand]`.
Ævar Arnfjörð Bjarmason60fadf82021-06-30 18:38:11 +020075Internally this is used to implement the `push.negotiate` option, see
76linkgit:git-config[1].
Jonathan Tan3390e422018-07-02 15:39:44 -070077
Jay Soffian28a15402009-11-10 09:19:43 +010078--dry-run::
79 Show what would be done, without making any changes.
Jay Soffian28a15402009-11-10 09:19:43 +010080
Junio C Hamano887952b2020-08-18 14:25:22 +000081ifndef::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.
88endif::git-pull[]
89
Stephan Beyer32402402008-06-08 03:36:09 +020090-f::
91--force::
Ævar Arnfjörð Bjarmasonae6a4702018-08-31 20:10:03 +000092 When 'git fetch' is used with `<src>:<dst>` refspec it may
93 refuse to update the local branch as discussed
94ifdef::git-pull[]
95 in the `<refspec>` part of the linkgit:git-fetch[1]
96 documentation.
97endif::git-pull[]
98ifndef::git-pull[]
99 in the `<refspec>` part below.
100endif::git-pull[]
101 This option overrides that check.
Jon Loeliger93d69d82005-11-06 23:30:56 -0600102
Jari Aalto6b276e12009-10-21 23:07:49 +0300103-k::
104--keep::
105 Keep downloaded pack.
106
Björn Gustavsson16679e32009-11-09 21:10:32 +0100107ifndef::git-pull[]
108--multiple::
109 Allow several <repository> and <group> arguments to be
110 specified. No <refspec>s may be specified.
Jay Soffianf360d842009-11-10 09:15:47 +0100111
Derrick Stoleea95ce122020-09-17 18:11:44 +0000112--[no-]auto-maintenance::
Nguyễn Thái Ngọc Duyc3d6b702019-06-19 16:46:30 +0700113--[no-]auto-gc::
Derrick Stoleea95ce122020-09-17 18:11:44 +0000114 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.
Nguyễn Thái Ngọc Duyc3d6b702019-06-19 16:46:30 +0700117
Johannes Schindelinc14e6e72019-11-03 00:21:56 +0000118--[no-]write-commit-graph::
119 Write a commit-graph after fetching. This overrides the config
120 setting `fetch.writeCommitGraph`.
René Scharfe9c688732020-03-09 22:51:39 +0100121endif::git-pull[]
Johannes Schindelinc14e6e72019-11-03 00:21:56 +0000122
Derrick Stolee2e031152021-04-16 12:49:57 +0000123--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
Oren Held1b79d1c2010-07-13 15:01:40 +0300128-p::
Jay Soffianf360d842009-11-10 09:15:47 +0100129--prune::
Jeff King9e702332016-06-13 19:58:51 -0400130 Before fetching, remove any remote-tracking references that no
Michael Haggerty0838bf42013-10-30 06:33:00 +0100131 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
Ævar Arnfjörð Bjarmason97716d22018-02-09 20:32:15 +0000137 subject to pruning. Supplying `--prune-tags` is a shorthand for
138 providing the tag refspec.
René Scharfe9c688732020-03-09 22:51:39 +0100139ifndef::git-pull[]
Ævar Arnfjörð Bjarmason97716d22018-02-09 20:32:15 +0000140+
141See 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.
Ævar Arnfjörð Bjarmason627a1292018-02-09 20:32:13 +0000151+
152See the PRUNING section below for more details.
153
Björn Gustavsson16679e32009-11-09 21:10:32 +0100154endif::git-pull[]
155
Miklos Vajna10eb64f2008-01-25 10:17:38 +0000156ifndef::git-pull[]
Stephan Beyer32402402008-06-08 03:36:09 +0200157-n::
Miklos Vajna10eb64f2008-01-25 10:17:38 +0000158endif::git-pull[]
Michael Haggerty01ca90c2013-10-30 06:33:05 +0100159--no-tags::
Miklos Vajna10eb64f2008-01-25 10:17:38 +0000160 By default, tags that point at objects that are downloaded
161 from the remote repository are fetched and stored locally.
Daniel Johnsoned368542010-08-11 18:57:20 -0400162 This option disables this automatic tag following. The default
Nguyễn Thái Ngọc Duyda0005b2015-03-11 16:32:45 -0400163 behavior for a remote may be specified with the remote.<name>.tagOpt
Daniel Johnsoned368542010-08-11 18:57:20 -0400164 setting. See linkgit:git-config[1].
Junio C Hamano03febf92006-01-07 00:48:04 -0800165
Robert Coup3c7bab02022-03-28 14:02:08 +0000166ifndef::git-pull[]
167--refetch::
168 Instead of negotiating with the server to avoid transferring commits and
169 associated objects that are already present locally, this option fetches
170 all objects as a fresh clone would. Use this to reapply a partial clone
171 filter from configuration or using `--filter=` when the filter
Robert Coup7390f052022-03-28 14:02:10 +0000172 definition has changed. Automatic post-fetch maintenance will perform
173 object database pack consolidation to remove any duplicate objects.
Robert Coup3c7bab02022-03-28 14:02:08 +0000174endif::git-pull[]
175
Junio C Hamanoc5558f82014-05-29 15:21:31 -0700176--refmap=<refspec>::
177 When fetching refs listed on the command line, use the
178 specified refspec (can be given more than once) to map the
179 refs to remote-tracking branches, instead of the values of
180 `remote.*.fetch` configuration variables for the remote
Derrick Stoleeb40a5022020-01-21 01:38:12 +0000181 repository. Providing an empty `<refspec>` to the
182 `--refmap` option causes Git to ignore the configured
183 refspecs and rely entirely on the refspecs supplied as
184 command-line arguments. See section on "Configured Remote-tracking
Junio C Hamanoc5558f82014-05-29 15:21:31 -0700185 Branches" for details.
186
Stephan Beyer32402402008-06-08 03:36:09 +0200187-t::
188--tags::
Michael Haggerty0838bf42013-10-30 06:33:00 +0100189 Fetch all tags from the remote (i.e., fetch remote tags
190 `refs/tags/*` into local tags with the same name), in addition
191 to whatever else would otherwise be fetched. Using this
192 option alone does not subject tags to pruning, even if --prune
193 is used (though tags may be pruned anyway if they are also the
Matthieu Moybcf96262016-06-28 13:40:11 +0200194 destination of an explicit refspec; see `--prune`).
Jon Loeliger93d69d82005-11-06 23:30:56 -0600195
René Scharfe9c688732020-03-09 22:51:39 +0100196ifndef::git-pull[]
Jens Lehmann8f0700d2011-03-06 23:11:21 +0100197--recurse-submodules[=yes|on-demand|no]::
198 This option controls if and under what conditions new commits of
Glen Choob90d9f72022-03-07 16:14:32 -0800199 submodules should be fetched too. When recursing through submodules,
200 `git fetch` always attempts to fetch "changed" submodules, that is, a
201 submodule that has commits that are referenced by a newly fetched
202 superproject commit but are missing in the local submodule clone. A
203 changed submodule can be fetched as long as it is present locally e.g.
204 in `$GIT_DIR/modules/` (see linkgit:gitsubmodules[7]); if the upstream
205 adds a new submodule, that submodule cannot be fetched until it is
206 cloned e.g. by `git submodule update`.
207+
208When set to 'on-demand', only changed submodules are fetched. When set
209to 'yes', all populated submodules are fetched and submodules that are
210both unpopulated and changed are fetched. When set to 'no', submodules
211are never fetched.
212+
213When unspecified, this uses the value of `fetch.recurseSubmodules` if it
214is set (see linkgit:git-config[1]), defaulting to 'on-demand' if unset.
215When this option is used without any value, it defaults to 'yes'.
René Scharfe9c688732020-03-09 22:51:39 +0100216endif::git-pull[]
Jens Lehmann8f0700d2011-03-06 23:11:21 +0100217
Stefan Beller62104ba2015-12-15 16:04:12 -0800218-j::
219--jobs=<n>::
Johannes Schindelind54dea72019-10-05 11:46:40 -0700220 Number of parallel children to be used for all forms of fetching.
221+
222If the `--multiple` option was specified, the different remotes will be fetched
223in parallel. If multiple submodules are fetched, they will be fetched in
224parallel. To control them independently, use the config settings
225`fetch.parallel` and `submodule.fetchJobs` (see linkgit:git-config[1]).
226+
227Typically, parallel recursive and multi-remote fetches will be faster. By
228default fetches are performed sequentially, not in parallel.
Stefan Beller62104ba2015-12-15 16:04:12 -0800229
René Scharfe9c688732020-03-09 22:51:39 +0100230ifndef::git-pull[]
Jens Lehmann8f0700d2011-03-06 23:11:21 +0100231--no-recurse-submodules::
232 Disable recursive fetching of submodules (this has the same effect as
Matthieu Moybcf96262016-06-28 13:40:11 +0200233 using the `--recurse-submodules=no` option).
René Scharfe9c688732020-03-09 22:51:39 +0100234endif::git-pull[]
Jens Lehmann7dce19d2010-11-12 13:54:52 +0100235
Corentin BOMPARD24bc1a12019-08-19 11:11:20 +0200236--set-upstream::
Philippe Blain847b3722020-08-12 23:52:00 +0000237 If the remote is fetched successfully, add upstream
Corentin BOMPARD24bc1a12019-08-19 11:11:20 +0200238 (tracking) reference, used by argument-less
239 linkgit:git-pull[1] and other commands. For more information,
240 see `branch.<name>.merge` and `branch.<name>.remote` in
241 linkgit:git-config[1].
242
René Scharfe9c688732020-03-09 22:51:39 +0100243ifndef::git-pull[]
Jens Lehmann7dce19d2010-11-12 13:54:52 +0100244--submodule-prefix=<path>::
245 Prepend <path> to paths printed in informative messages
246 such as "Fetching submodule foo". This option is used
247 internally when recursing over submodules.
Jens Lehmann88a21972011-03-06 23:10:46 +0100248
249--recurse-submodules-default=[yes|on-demand]::
250 This option is used internally to temporarily provide a
251 non-negative default value for the --recurse-submodules
252 option. All other methods of configuring fetch's submodule
253 recursion (such as settings in linkgit:gitmodules[5] and
254 linkgit:git-config[1]) override this option, as does
255 specifying --[no-]recurse-submodules directly.
Jens Lehmann7dce19d2010-11-12 13:54:52 +0100256
Stephan Beyer32402402008-06-08 03:36:09 +0200257-u::
258--update-head-ok::
Thomas Rast0b444cd2010-01-10 00:33:00 +0100259 By default 'git fetch' refuses to update the head which
Jon Loeliger93d69d82005-11-06 23:30:56 -0600260 corresponds to the current branch. This flag disables the
Thomas Rast0b444cd2010-01-10 00:33:00 +0100261 check. This is purely for the internal use for 'git pull'
262 to communicate with 'git fetch', and unless you are
Junio C Hamanoa597fb02007-01-01 15:07:35 -0800263 implementing your own Porcelain you are not supposed to
264 use it.
René Scharfef05558f2020-03-28 15:48:33 +0100265endif::git-pull[]
Junio C Hamano03febf92006-01-07 00:48:04 -0800266
Jari Aalto6b276e12009-10-21 23:07:49 +0300267--upload-pack <upload-pack>::
268 When given, and the repository to fetch from is handled
Matthieu Moybcf96262016-06-28 13:40:11 +0200269 by 'git fetch-pack', `--exec=<upload-pack>` is passed to
Jari Aalto6b276e12009-10-21 23:07:49 +0300270 the command to specify non-default path for the command
271 run on the other end.
272
273ifndef::git-pull[]
274-q::
275--quiet::
276 Pass --quiet to git-fetch-pack and silence any other internally
Tay Ray Chuan98390182010-02-24 20:50:28 +0800277 used git commands. Progress is not reported to the standard error
278 stream.
Jari Aalto6b276e12009-10-21 23:07:49 +0300279
280-v::
281--verbose::
282 Be verbose.
283endif::git-pull[]
Tay Ray Chuan98390182010-02-24 20:50:28 +0800284
285--progress::
286 Progress status is reported on the standard error stream
287 by default when it is attached to a terminal, unless -q
288 is specified. This flag forces progress status even if the
289 standard error stream is not directed to a terminal.
Eric Wongc915f112016-02-03 04:09:14 +0000290
Brandon Williams5e3548e2018-04-23 15:46:24 -0700291-o <option>::
292--server-option=<option>::
293 Transmit the given string to the server when communicating using
294 protocol version 2. The given string must not contain a NUL or LF
Jonathan Tan6e983052019-04-12 12:51:22 -0700295 character. The server's handling of server options, including
296 unknown ones, is server-specific.
Brandon Williams5e3548e2018-04-23 15:46:24 -0700297 When multiple `--server-option=<option>` are given, they are all
298 sent to the other side in the order listed on the command line.
299
Derrick Stoleecdbd70c2019-06-18 13:25:26 -0700300--show-forced-updates::
301 By default, git checks if a branch is force-updated during
302 fetch. This can be disabled through fetch.showForcedUpdates, but
303 the --show-forced-updates option guarantees this check occurs.
304 See linkgit:git-config[1].
305
306--no-show-forced-updates::
307 By default, git checks if a branch is force-updated during
308 fetch. Pass --no-show-forced-updates or set fetch.showForcedUpdates
309 to false to skip this check for performance reasons. If used during
310 'git-pull' the --ff-only option will still check for forced updates
311 before attempting a fast-forward update. See linkgit:git-config[1].
312
Eric Wongc915f112016-02-03 04:09:14 +0000313-4::
314--ipv4::
315 Use IPv4 addresses only, ignoring IPv6 addresses.
316
317-6::
318--ipv6::
319 Use IPv6 addresses only, ignoring IPv4 addresses.