git fetch [remote] [branch] [refspec]

Download objects and refs from another repository

Arguments

NameDescription
remote
branch
refspec

Options

NameDescription
--allFetch all remotes
-a, --appendAppend ref names and object names of fetched refs to the existing contents of .git/FETCH_HEAD
--atomicUse an atomic transaction to update local refs. Either all refs are updated, or on error, no refs are updated
--depth <depth>Limit fetching to the specified number of commits from the tip of each remote branch history
--deepen <depth>Similar to --depth, except it specifies the number of commits from the current shallow boundary instead of from the tip of each remote branch history
--shallow-since <date>Deepen or shorten the history of a shallow repository to include all reachable commits after <date>
--shallow-exclude <revision>Deepen or shorten the history of a shallow repository to exclude commits reachable from a specified remote branch or tag. This option can be specified multiple times
--unshallowIf the source repository is shallow, fetch as much as possible so that the current repository has the same history as the source repository
--update-shallowBy default when fetching from a shallow repository, git fetch refuses refs that require updating .git/shallow
--negotiation-tip <commit|glob>By default, Git will report, to the server, commits reachable from all local refs to find common commits in an attempt to reduce the size of the to-be-received packfile
--dry-runShow what would be done, without making any changes
--write-fetch-headWrite the list of remote refs fetched in the FETCH_HEAD file directly under $GIT_DIR. This is the default
--no-write-fetch-headTells Git not to write the file
-f, --forceThis option overrides that check
-k, --keepKeep downloaded pack
--multipleAllow several <repository> and <group> arguments to be specified. No <refspec>s may be specified
--auto-maintenance, --auto-gcRun git maintenance run --auto at the end to perform automatic repository maintenance if
--no-auto-maintenance, --no-auto-gcDon't run git maintenance run --auto at the end to perform automatic repository maintenance
--write-commit-graphWrite a commit-graph after fetching. This overrides the config setting fetch.writeCommitGraph
--no-write-commit-graphDon't write a commit-graph after fetching. This overrides the config setting fetch.writeCommitGraph
-p, --pruneBefore fetching, remove any remote-tracking references that no longer exist on the remote
-P, --prune-tagsBefore fetching, remove any local tags that no longer exist on the remote if --prune is enabled
-n, --no-tagsBy default, tags that point at objects that are downloaded from the remote repository are fetched and stored locally. This option disables this automatic tag following
--refmap <refspec>When fetching refs listed on the command line, use the specified refspec (can be given more than once) to map the refs to remote-tracking branches, instead of the values of remote.*.fetch configuration variables for the remote repository
-t, --tagsBy default, tags that point at objects that are downloaded from the remote repository are fetched and stored locally. This option disables this automatic tag following
--recurse-submodules [mode]When fetching refs listed on the command line, use the specified refspec (can be given more than once) to map the refs to remote-tracking branches, instead of the values of remote.*.fetch configuration variables for the remote repository
-j, --jobs <n>Number of parallel children to be used for all forms of fetching
--no-recurse-submodulesDisable recursive fetching of submodules (this has the same effect as using the --recurse-submodules=no option)
--set-upstreamIf the remote is fetched successfully, add upstream (tracking) reference, used by argument-less git-pull[1] and other commands
--submodule-prefix <path>Prepend <path> to paths printed in informative messages such as ”Fetching submodule foo". This option is used internally when recursing over submodules
--recurse-submodules-default [mode]This option is used internally to temporarily provide a non-negative default value for the --recurse-submodules option
-u, --update-head-okBy default git fetch refuses to update the head which corresponds to the current branch. This flag disables the check. This is purely for the internal use for git pull to communicate with git fetch, and unless you are implementing your own Porcelain you are not supposed to use it
--upload-pack <upload-pack>When given, and the repository to fetch from is handled by git fetch-pack, --exec=<upload-pack> is passed to the command to specify non-default path for the command run on the other end
-q, --quietPass --quiet to git-fetch-pack and silence any other internally used git commands. Progress is not reported to the standard error stream
-v, --verboseBe verbose
--progressProgress status is reported on the standard error stream by default when it is attached to a terminal, unless -q is specified
-o, --server-option <option>Transmit the given string to the server when communicating using protocol version 2. The given string must not contain a NUL or LF character
--show-forced-updatesBy default, git checks if a branch is force-updated during fetch. This can be disabled through fetch.showForcedUpdates, but the --show-forced-updates option guarantees this check occurs
--no-show-forced-updatesBy default, git checks if a branch is force-updated during fetch. Pass --no-show-forced-updates or set fetch.showForcedUpdates to false to skip this check for performance reasons
-4, --ipv4Use IPv4 addresses only, ignoring IPv6 addresses
-6, --ipv6Use IPv6 addresses only, ignoring IPv4 addresses
--stdinRead refspecs, one per line, from stdin in addition to those provided as arguments. The "tag <name>" format is not supported