blob: 07783deee309008fc152b79ed7b69dad019c6c2c [file] [log] [blame]
Junio C Hamano9df0c662009-11-23 11:09:271--all::
2Fetch all remotes.
3
Junio C Hamanoeb415992008-06-08 22:49:474-a::
5--append::
Junio C Hamano1a4e8412005-12-27 08:17:236Append ref names and object names of fetched refs to the
7existing contents of `.git/FETCH_HEAD`. Without this
8option old data in `.git/FETCH_HEAD` will be overwritten.
9
Junio C Hamano7887f9b2021-01-25 23:32:3310--atomic::
11Use an atomic transaction to update local refs. Either all refs are
12updated, or on error, no refs are updated.
13
Junio C Hamanoc21ab052009-10-31 04:03:5514--depth=<depth>::
Junio C Hamano4e6ba272016-01-20 23:23:1915Limit fetching to the specified number of commits from the tip of
16each remote branch history. If fetching to a 'shallow' repository
17created by `git clone` with `--depth=<depth>` option (see
18linkgit:git-clone[1]), deepen or shorten the history to the specified
19number of commits. Tags for the deepened commits are not fetched.
Junio C Hamanoe663a7a2006-01-25 12:37:2820
Junio C Hamano20829a42016-10-10 23:24:4421--deepen=<depth>::
22Similar to --depth, except it specifies the number of commits
23from the current shallow boundary instead of from the tip of
24each remote branch history.
25
26--shallow-since=<date>::
27Deepen or shorten the history of a shallow repository to
28include all reachable commits after <date>.
29
30--shallow-exclude=<revision>::
31Deepen or shorten the history of a shallow repository to
32exclude commits reachable from a specified remote branch or tag.
33This option can be specified multiple times.
34
Junio C Hamano0d1122e2013-02-01 21:37:0235--unshallow::
Junio C Hamano61525f92014-01-17 22:46:4936If the source repository is complete, convert a shallow
37repository to a complete one, removing all the limitations
38imposed 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.
42
43--update-shallow::
44By 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
47refs.
Junio C Hamano0d1122e2013-02-01 21:37:0248
Junio C Hamanof09b7cd2018-08-02 23:01:4549--negotiation-tip=<commit|glob>::
50By default, Git will report, to the server, commits reachable
51from all local refs to find common commits in an attempt to
52reduce the size of the to-be-received packfile. If specified,
53Git will only report commits reachable from the given tips.
54This is useful to speed up fetches when the user knows which
55local ref is likely to have commits in common with the
56upstream 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.
Junio C Hamanobfd91f42018-08-17 22:21:1664+
65See also the `fetch.negotiationAlgorithm` configuration variable
66documented in linkgit:git-config[1].
Junio C Hamanof09b7cd2018-08-02 23:01:4567
Junio C Hamano9df0c662009-11-23 11:09:2768--dry-run::
69Show what would be done, without making any changes.
Junio C Hamano9df0c662009-11-23 11:09:2770
Junio C Hamano48d7a8a2020-08-24 22:56:5671ifndef::git-pull[]
72--[no-]write-fetch-head::
73Write the list of remote refs fetched in the `FETCH_HEAD`
74file directly under `$GIT_DIR`. This is the default.
75Passing `--no-write-fetch-head` from the command line tells
76Git not to write the file. Under `--dry-run` option, the
77file is never written.
78endif::git-pull[]
79
Junio C Hamanoeb415992008-06-08 22:49:4780-f::
81--force::
Junio C Hamano980e61e2018-09-17 22:45:5282When 'git fetch' is used with `<src>:<dst>` refspec it may
83refuse to update the local branch as discussed
84ifdef::git-pull[]
85in the `<refspec>` part of the linkgit:git-fetch[1]
86documentation.
87endif::git-pull[]
88ifndef::git-pull[]
89in the `<refspec>` part below.
90endif::git-pull[]
91This option overrides that check.
Junio C Hamano1a4e8412005-12-27 08:17:2392
Junio C Hamanoc21ab052009-10-31 04:03:5593-k::
94--keep::
95Keep downloaded pack.
96
Junio C Hamano9df0c662009-11-23 11:09:2797ifndef::git-pull[]
98--multiple::
99Allow several <repository> and <group> arguments to be
100specified. No <refspec>s may be specified.
101
Junio C Hamanoc562f6d2020-09-25 22:50:12102--[no-]auto-maintenance::
Junio C Hamanoc9f11c22019-07-10 02:54:04103--[no-]auto-gc::
Junio C Hamanoc562f6d2020-09-25 22:50:12104Run `git maintenance run --auto` at the end to perform automatic
105repository maintenance if needed. (`--[no-]auto-gc` is a synonym.)
106This is enabled by default.
Junio C Hamanoc9f11c22019-07-10 02:54:04107
Junio C Hamano8ef91f32019-12-01 22:58:27108--[no-]write-commit-graph::
109Write a commit-graph after fetching. This overrides the config
110setting `fetch.writeCommitGraph`.
Junio C Hamano357906b2020-03-25 21:32:01111endif::git-pull[]
Junio C Hamano8ef91f32019-12-01 22:58:27112
Junio C Hamano70664a02010-07-13 22:48:05113-p::
Junio C Hamano9df0c662009-11-23 11:09:27114--prune::
Junio C Hamano042f2142016-06-27 18:05:05115Before fetching, remove any remote-tracking references that no
Junio C Hamano4c8f2d92013-12-13 00:55:42116longer exist on the remote. Tags are not subject to pruning
117if they are fetched only because of the default tag
118auto-following or due to a --tags option. However, if tags
119are fetched due to an explicit refspec (either on the command
120line or in the remote configuration, for example if the remote
121was cloned with the --mirror option), then they are also
Junio C Hamano664750f2018-03-06 23:25:44122subject to pruning. Supplying `--prune-tags` is a shorthand for
123providing the tag refspec.
Junio C Hamano357906b2020-03-25 21:32:01124ifndef::git-pull[]
Junio C Hamano664750f2018-03-06 23:25:44125+
126See the PRUNING section below for more details.
127
128-P::
129--prune-tags::
130Before fetching, remove any local tags that no longer exist on
131the remote if `--prune` is enabled. This option should be used
132more carefully, unlike `--prune` it will remove any local
133references (local tags) that have been created. This option is
134a shorthand for providing the explicit tag refspec along with
135`--prune`, see the discussion about that in its documentation.
136+
137See the PRUNING section below for more details.
138
Junio C Hamano9df0c662009-11-23 11:09:27139endif::git-pull[]
140
Junio C Hamanof7bb6692008-01-27 08:23:46141ifndef::git-pull[]
Junio C Hamanoeb415992008-06-08 22:49:47142-n::
Junio C Hamanof7bb6692008-01-27 08:23:46143endif::git-pull[]
Junio C Hamano4c8f2d92013-12-13 00:55:42144--no-tags::
Junio C Hamanof7bb6692008-01-27 08:23:46145By default, tags that point at objects that are downloaded
146from the remote repository are fetched and stored locally.
Junio C Hamano075ae872010-09-01 18:43:07147This option disables this automatic tag following. The default
Junio C Hamano322c6242015-03-23 21:32:46148behavior for a remote may be specified with the remote.<name>.tagOpt
Junio C Hamano075ae872010-09-01 18:43:07149setting. See linkgit:git-config[1].
Junio C Hamano4d04a402006-01-09 00:53:28150
Junio C Hamano45f804f2014-06-20 22:24:49151--refmap=<refspec>::
152When fetching refs listed on the command line, use the
153specified refspec (can be given more than once) to map the
154refs to remote-tracking branches, instead of the values of
155`remote.*.fetch` configuration variables for the remote
Junio C Hamanobee061d2020-01-30 23:21:18156repository. Providing an empty `<refspec>` to the
157`--refmap` option causes Git to ignore the configured
158refspecs and rely entirely on the refspecs supplied as
159command-line arguments. See section on "Configured Remote-tracking
Junio C Hamano45f804f2014-06-20 22:24:49160Branches" for details.
161
Junio C Hamanoeb415992008-06-08 22:49:47162-t::
163--tags::
Junio C Hamano4c8f2d92013-12-13 00:55:42164Fetch all tags from the remote (i.e., fetch remote tags
165`refs/tags/*` into local tags with the same name), in addition
166to whatever else would otherwise be fetched. Using this
167option alone does not subject tags to pruning, even if --prune
168is used (though tags may be pruned anyway if they are also the
Junio C Hamano92d80372016-07-13 22:00:05169destination of an explicit refspec; see `--prune`).
Junio C Hamano1a4e8412005-12-27 08:17:23170
Junio C Hamano357906b2020-03-25 21:32:01171ifndef::git-pull[]
Junio C Hamano5cd15182011-04-05 00:21:10172--recurse-submodules[=yes|on-demand|no]::
173This option controls if and under what conditions new commits of
174populated submodules should be fetched too. It can be used as a
175boolean option to completely disable recursion when set to 'no' or to
176unconditionally recurse into all populated submodules when set to
177'yes', which is the default when this option is used without any
178value. Use 'on-demand' to only recurse into a populated submodule
179when the superproject retrieves a commit that updates the submodule's
180reference to a commit that isn't already in the local submodule
Junio C Hamano0dd50942020-04-29 21:21:05181clone. By default, 'on-demand' is used, unless
182`fetch.recurseSubmodules` is set (see linkgit:git-config[1]).
Junio C Hamano357906b2020-03-25 21:32:01183endif::git-pull[]
Junio C Hamano5cd15182011-04-05 00:21:10184
Junio C Hamanoa7da1ba2016-01-13 00:19:45185-j::
186--jobs=<n>::
Junio C Hamanofa2a48b2019-10-15 05:24:40187Number of parallel children to be used for all forms of fetching.
188+
189If the `--multiple` option was specified, the different remotes will be fetched
190in parallel. If multiple submodules are fetched, they will be fetched in
191parallel. To control them independently, use the config settings
192`fetch.parallel` and `submodule.fetchJobs` (see linkgit:git-config[1]).
193+
194Typically, parallel recursive and multi-remote fetches will be faster. By
195default fetches are performed sequentially, not in parallel.
Junio C Hamanoa7da1ba2016-01-13 00:19:45196
Junio C Hamano357906b2020-03-25 21:32:01197ifndef::git-pull[]
Junio C Hamano5cd15182011-04-05 00:21:10198--no-recurse-submodules::
199Disable recursive fetching of submodules (this has the same effect as
Junio C Hamano92d80372016-07-13 22:00:05200using the `--recurse-submodules=no` option).
Junio C Hamano357906b2020-03-25 21:32:01201endif::git-pull[]
Junio C Hamano0d75e872010-12-17 06:57:26202
Junio C Hamanocb705392019-09-18 19:30:01203--set-upstream::
Junio C Hamano779537c2020-08-19 23:48:51204If the remote is fetched successfully, add upstream
Junio C Hamanocb705392019-09-18 19:30:01205(tracking) reference, used by argument-less
206linkgit:git-pull[1] and other commands. For more information,
207see `branch.<name>.merge` and `branch.<name>.remote` in
208linkgit:git-config[1].
209
Junio C Hamano357906b2020-03-25 21:32:01210ifndef::git-pull[]
Junio C Hamano0d75e872010-12-17 06:57:26211--submodule-prefix=<path>::
212Prepend <path> to paths printed in informative messages
213such as "Fetching submodule foo". This option is used
214internally when recursing over submodules.
Junio C Hamano5cd15182011-04-05 00:21:10215
216--recurse-submodules-default=[yes|on-demand]::
217This option is used internally to temporarily provide a
218non-negative default value for the --recurse-submodules
219option. All other methods of configuring fetch's submodule
220recursion (such as settings in linkgit:gitmodules[5] and
221linkgit:git-config[1]) override this option, as does
222specifying --[no-]recurse-submodules directly.
Junio C Hamano0d75e872010-12-17 06:57:26223
Junio C Hamanoeb415992008-06-08 22:49:47224-u::
225--update-head-ok::
Junio C Hamano1aa40d22010-01-21 17:46:43226By default 'git fetch' refuses to update the head which
Junio C Hamano1a4e8412005-12-27 08:17:23227corresponds to the current branch. This flag disables the
Junio C Hamano1aa40d22010-01-21 17:46:43228check. This is purely for the internal use for 'git pull'
229to communicate with 'git fetch', and unless you are
Junio C Hamanob288d9e2007-01-02 00:04:15230implementing your own Porcelain you are not supposed to
231use it.
Junio C Hamano67bf2242020-04-22 21:41:44232endif::git-pull[]
Junio C Hamanob288d9e2007-01-02 00:04:15233
Junio C Hamanoc21ab052009-10-31 04:03:55234--upload-pack <upload-pack>::
235When given, and the repository to fetch from is handled
Junio C Hamano92d80372016-07-13 22:00:05236by 'git fetch-pack', `--exec=<upload-pack>` is passed to
Junio C Hamanoc21ab052009-10-31 04:03:55237the command to specify non-default path for the command
238run on the other end.
239
240ifndef::git-pull[]
241-q::
242--quiet::
243Pass --quiet to git-fetch-pack and silence any other internally
Junio C Hamanoea90ab32010-03-15 20:32:55244used git commands. Progress is not reported to the standard error
245stream.
Junio C Hamanoc21ab052009-10-31 04:03:55246
247-v::
248--verbose::
249Be verbose.
250endif::git-pull[]
Junio C Hamanoea90ab32010-03-15 20:32:55251
252--progress::
253Progress status is reported on the standard error stream
254by default when it is attached to a terminal, unless -q
255is specified. This flag forces progress status even if the
256standard error stream is not directed to a terminal.
Junio C Hamano3fcdd072016-02-24 23:41:08257
Junio C Hamanob9d9d902018-05-23 07:07:42258-o <option>::
259--server-option=<option>::
260Transmit the given string to the server when communicating using
261protocol version 2. The given string must not contain a NUL or LF
Junio C Hamanod1063b12019-05-08 17:18:07262character. The server's handling of server options, including
263unknown ones, is server-specific.
Junio C Hamanob9d9d902018-05-23 07:07:42264When multiple `--server-option=<option>` are given, they are all
265sent to the other side in the order listed on the command line.
266
Junio C Hamanoc9f11c22019-07-10 02:54:04267--show-forced-updates::
268By default, git checks if a branch is force-updated during
269fetch. This can be disabled through fetch.showForcedUpdates, but
270the --show-forced-updates option guarantees this check occurs.
271See linkgit:git-config[1].
272
273--no-show-forced-updates::
274By default, git checks if a branch is force-updated during
275fetch. Pass --no-show-forced-updates or set fetch.showForcedUpdates
276to false to skip this check for performance reasons. If used during
277'git-pull' the --ff-only option will still check for forced updates
278before attempting a fast-forward update. See linkgit:git-config[1].
279
Junio C Hamano3fcdd072016-02-24 23:41:08280-4::
281--ipv4::
282Use IPv4 addresses only, ignoring IPv6 addresses.
283
284-6::
285--ipv6::
286Use IPv6 addresses only, ignoring IPv4 addresses.