{
    "content": [
        {
            "type": "text",
            "text": "# git-fetch (man)\n\n## NAME\n\ngit-fetch - Download objects and refs from another repository\n\n## SYNOPSIS\n\ngit fetch [<options>] [<repository> [<refspec>...]]\ngit fetch [<options>] <group>\ngit fetch --multiple [<options>] [(<repository> | <group>)...]\ngit fetch --all [<options>]\n\n## DESCRIPTION\n\nFetch branches and/or tags (collectively, \"refs\") from one or more other repositories, along\nwith the objects necessary to complete their histories. Remote-tracking branches are updated\n(see the description of <refspec> below for ways to control this behavior).\n\n## TLDR\n\n> Download objects and refs from a remote repository.\n\n- Fetch the latest changes from the default remote upstream repository (if set):\n  `git fetch`\n- Fetch new branches from a specific remote upstream repository:\n  `git fetch {{remote_name}}`\n- Fetch the latest changes from all remote upstream repositories:\n  `git fetch --all`\n- Also fetch tags from the remote upstream repository:\n  `git fetch {{-t|--tags}}`\n- Delete local references to remote branches that have been deleted upstream:\n  `git fetch {{-p|--prune}}`\n- Deepen current shallow branch by 2 commits:\n  `git fetch --deepen 2`\n- Update the `main` branch without switching to it (equivalent to `git pull`):\n  `git fetch {{origin}} main:main`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **OPTIONS** (26 subsections)\n- **GIT URLS**\n- **REMOTES** (1 subsections)\n- **CONFIGURED REMOTE-TRACKING BRANCHES**\n- **PRUNING** (1 subsections)\n- **OUTPUT**\n- **EXAMPLES**\n- **SECURITY**\n- **BUGS**\n- **SEE ALSO**\n- **GIT**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "git-fetch",
        "section": "",
        "mode": "man",
        "summary": "git-fetch - Download objects and refs from another repository",
        "synopsis": "git fetch [<options>] [<repository> [<refspec>...]]\ngit fetch [<options>] <group>\ngit fetch --multiple [<options>] [(<repository> | <group>)...]\ngit fetch --all [<options>]",
        "tldr_summary": "Download objects and refs from a remote repository.",
        "tldr_examples": [
            {
                "description": "Fetch the latest changes from the default remote upstream repository (if set)",
                "command": "git fetch"
            },
            {
                "description": "Fetch new branches from a specific remote upstream repository",
                "command": "git fetch {{remote_name}}"
            },
            {
                "description": "Fetch the latest changes from all remote upstream repositories",
                "command": "git fetch --all"
            },
            {
                "description": "Also fetch tags from the remote upstream repository",
                "command": "git fetch {{-t|--tags}}"
            },
            {
                "description": "Delete local references to remote branches that have been deleted upstream",
                "command": "git fetch {{-p|--prune}}"
            },
            {
                "description": "Deepen current shallow branch by 2 commits",
                "command": "git fetch --deepen 2"
            },
            {
                "description": "Update the `main` branch without switching to it (equivalent to `git pull`)",
                "command": "git fetch {{origin}} main:main"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "",
                "long": "--all",
                "arg": null,
                "description": "Fetch all remotes."
            },
            {
                "flag": "-a",
                "long": "--append",
                "arg": null,
                "description": "Append ref names and object names of fetched refs to the existing contents of .git/FETCHHEAD. Without this option old data in .git/FETCHHEAD will be overwritten."
            },
            {
                "flag": "",
                "long": "--atomic",
                "arg": null,
                "description": "Use 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. If fetching to a shallow repository created by git clone with --depth=<depth> option (see git-clone(1)), deepen or shorten the history to the specified number of commits. Tags for the deepened commits are not fetched. --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."
            },
            {
                "flag": "",
                "long": "--unshallow",
                "arg": null,
                "description": "If the source repository is complete, convert a shallow repository to a complete one, removing all the limitations imposed by shallow repositories. If the source repository is shallow, fetch as much as possible so that the current repository has the same history as the source repository."
            },
            {
                "flag": "",
                "long": "--update-shallow",
                "arg": null,
                "description": "By default when fetching from a shallow repository, git fetch refuses refs that require updating .git/shallow. This option updates .git/shallow and accept such refs. --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. If specified, Git will only report commits reachable from the given tips. This is useful to speed up fetches when the user knows which local ref is likely to have commits in common with the upstream ref being fetched. This option may be specified more than once; if so, Git will report commits reachable from any of the given commits. The argument to this option may be a glob on ref names, a ref, or the (possibly abbreviated) SHA-1 of a commit. Specifying a glob is equivalent to specifying this option multiple times, one for each matching ref name. See also the fetch.negotiationAlgorithm and push.negotiate configuration variables documented in git-config(1), and the --negotiate-only option below."
            },
            {
                "flag": "",
                "long": "--negotiate-only",
                "arg": null,
                "description": "Do not fetch anything from the server, and instead print the ancestors of the provided --negotiation-tip=* arguments, which we have in common with the server. Internally this is used to implement the push.negotiate option, see git-config(1)."
            },
            {
                "flag": "",
                "long": "--dry-run",
                "arg": null,
                "description": "Show what would be done, without making any changes. --[no-]write-fetch-head Write the list of remote refs fetched in the FETCHHEAD file directly under $GITDIR. This is the default. Passing --no-write-fetch-head from the command line tells Git not to write the file. Under --dry-run option, the file is never written."
            },
            {
                "flag": "-f",
                "long": "--force",
                "arg": null,
                "description": "When git fetch is used with <src>:<dst> refspec it may refuse to update the local branch as discussed in the <refspec> part below. This option overrides that check."
            },
            {
                "flag": "-k",
                "long": "--keep",
                "arg": null,
                "description": "Keep downloaded pack."
            },
            {
                "flag": "",
                "long": "--multiple",
                "arg": null,
                "description": "Allow several <repository> and <group> arguments to be specified. No <refspec>s may be specified. --[no-]auto-maintenance, --[no-]auto-gc Run git maintenance run --auto at the end to perform automatic repository maintenance if needed. (--[no-]auto-gc is a synonym.) This is enabled by default. --[no-]write-commit-graph Write a commit-graph after fetching. This overrides the config setting fetch.writeCommitGraph."
            },
            {
                "flag": "",
                "long": "--prefetch",
                "arg": null,
                "description": "Modify the configured refspec to place all refs into the refs/prefetch/ namespace. See the prefetch task in git-maintenance(1)."
            },
            {
                "flag": "-p",
                "long": "--prune",
                "arg": null,
                "description": "Before fetching, remove any remote-tracking references that no longer exist on the remote. Tags are not subject to pruning if they are fetched only because of the default tag auto-following or due to a --tags option. However, if tags are fetched due to an explicit refspec (either on the command line or in the remote configuration, for example if the remote was cloned with the --mirror option), then they are also subject to pruning. Supplying --prune-tags is a shorthand for providing the tag refspec. See the PRUNING section below for more details."
            },
            {
                "flag": "-P",
                "long": "--prune-tags",
                "arg": null,
                "description": "Before fetching, remove any local tags that no longer exist on the remote if --prune is enabled. This option should be used more carefully, unlike --prune it will remove any local references (local tags) that have been created. This option is a shorthand for providing the explicit tag refspec along with --prune, see the discussion about that in its documentation. See the PRUNING section below for more details."
            },
            {
                "flag": "-n",
                "long": "--no-tags",
                "arg": null,
                "description": "By 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. The default behavior for a remote may be specified with the remote.<name>.tagOpt setting. See git-config(1). --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. Providing an empty <refspec> to the --refmap option causes Git to ignore the configured refspecs and rely entirely on the refspecs supplied as command-line arguments. See section on \"Configured Remote-tracking Branches\" for details."
            },
            {
                "flag": "-t",
                "long": "--tags",
                "arg": null,
                "description": "Fetch all tags from the remote (i.e., fetch remote tags refs/tags/* into local tags with the same name), in addition to whatever else would otherwise be fetched. Using this option alone does not subject tags to pruning, even if --prune is used (though tags may be pruned anyway if they are also the destination of an explicit refspec; see --prune)."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "This option controls if and under what conditions new commits of populated submodules should be fetched too. It can be used as a boolean option to completely disable recursion when set to no or to unconditionally recurse into all populated submodules when set to yes, which is the default when this option is used without any value. Use on-demand to only recurse into a populated submodule when the superproject retrieves a commit that updates the submodule’s reference to a commit that isn’t already in the local submodule clone. By default, on-demand is used, unless fetch.recurseSubmodules is set (see git- config(1)). -j, --jobs=<n> Number of parallel children to be used for all forms of fetching. If the --multiple option was specified, the different remotes will be fetched in parallel. If multiple submodules are fetched, they will be fetched in parallel. To control them independently, use the config settings fetch.parallel and submodule.fetchJobs (see git-config(1)). Typically, parallel recursive and multi-remote fetches will be faster. By default fetches are performed sequentially, not in parallel."
            },
            {
                "flag": "",
                "long": "--no-recurse-submodules",
                "arg": null,
                "description": "Disable recursive fetching of submodules (this has the same effect as using the --recurse-submodules=no option)."
            },
            {
                "flag": "",
                "long": "--set-upstream",
                "arg": null,
                "description": "If the remote is fetched successfully, add upstream (tracking) reference, used by argument-less git-pull(1) and other commands. For more information, see branch.<name>.merge and branch.<name>.remote in git-config(1). --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=[yes|on-demand] This option is used internally to temporarily provide a non-negative default value for the --recurse-submodules option. All other methods of configuring fetch’s submodule recursion (such as settings in gitmodules(5) and git-config(1)) override this option, as does specifying --[no-]recurse-submodules directly."
            },
            {
                "flag": "-u",
                "long": "--update-head-ok",
                "arg": null,
                "description": "By 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."
            },
            {
                "flag": "",
                "long": "--upload-pack",
                "arg": "<upload-pack>",
                "description": "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."
            },
            {
                "flag": "-q",
                "long": "--quiet",
                "arg": null,
                "description": "Pass --quiet to git-fetch-pack and silence any other internally used git commands. Progress is not reported to the standard error stream."
            },
            {
                "flag": "-v",
                "long": "--verbose",
                "arg": null,
                "description": "Be verbose."
            },
            {
                "flag": "",
                "long": "--progress",
                "arg": null,
                "description": "Progress status is reported on the standard error stream by default when it is attached to a terminal, unless -q is specified. This flag forces progress status even if the standard error stream is not directed to a terminal. -o <option>, --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. The server’s handling of server options, including unknown ones, is server-specific. When multiple --server-option=<option> are given, they are all sent to the other side in the order listed on the command line."
            },
            {
                "flag": "",
                "long": "--show-forced-updates",
                "arg": null,
                "description": "By 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. See git-config(1)."
            },
            {
                "flag": "",
                "long": "--no-show-forced-updates",
                "arg": null,
                "description": "By 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. If used during git-pull the --ff-only option will still check for forced updates before attempting a fast-forward update. See git-config(1). -4, --ipv4 Use IPv4 addresses only, ignoring IPv6 addresses. -6, --ipv6 Use IPv6 addresses only, ignoring IPv4 addresses. <repository> The \"remote\" repository that is the source of a fetch or pull operation. This parameter can be either a URL (see the section GIT URLS below) or the name of a remote (see the section REMOTES below). <group> A name referring to a list of repositories as the value of remotes.<group> in the configuration file. (See git-config(1)). <refspec> Specifies which refs to fetch and which local refs to update. When no <refspec>s appear on the command line, the refs to fetch are read from remote.<repository>.fetch variables instead (see CONFIGURED REMOTE-TRACKING BRANCHES below). The format of a <refspec> parameter is an optional plus +, followed by the source <src>, followed by a colon :, followed by the destination ref <dst>. The colon can be omitted when <dst> is empty. <src> is typically a ref, but it can also be a fully spelled hex object name. A <refspec> may contain a * in its <src> to indicate a simple pattern match. Such a refspec functions like a glob that matches any ref with the same prefix. A pattern <refspec> must have a * in both the <src> and <dst>. It will map refs to the destination by replacing the * with the contents matched from the source. If a refspec is prefixed by ^, it will be interpreted as a negative refspec. Rather than specifying which refs to fetch or which local refs to update, such a refspec will instead specify refs to exclude. A ref will be considered to match if it matches at least one positive refspec, and does not match any negative refspec. Negative refspecs can be useful to restrict the scope of a pattern refspec so that it will not include specific refs. Negative refspecs can themselves be pattern refspecs. However, they may only contain a <src> and do not specify a <dst>. Fully spelled out hex object names are also not supported. tag <tag> means the same as refs/tags/<tag>:refs/tags/<tag>; it requests fetching everything up to the given tag. The remote ref that matches <src> is fetched, and if <dst> is not an empty string, an attempt is made to update the local ref that matches it. Whether that update is allowed without --force depends on the ref namespace it’s being fetched to, the type of object being fetched, and whether the update is considered to be a fast-forward. Generally, the same rules apply for fetching as when pushing, see the <refspec>... section of git-push(1) for what those are. Exceptions to those rules particular to git fetch are noted below. Until Git version 2.20, and unlike when pushing with git-push(1), any updates to refs/tags/* would be accepted without + in the refspec (or --force). When fetching, we promiscuously considered all tag updates from a remote to be forced fetches. Since Git version 2.20, fetching to update refs/tags/* works the same way as when pushing. I.e. any updates will be rejected without + in the refspec (or --force). Unlike when pushing with git-push(1), any updates outside of refs/{tags,heads}/* will be accepted without + in the refspec (or --force), whether that’s swapping e.g. a tree object for a blob, or a commit for another commit that’s doesn’t have the previous commit as an ancestor etc. Unlike when pushing with git-push(1), there is no configuration which’ll amend these rules, and nothing like a pre-fetch hook analogous to the pre-receive hook. As with pushing with git-push(1), all of the rules described above about what’s not allowed as an update can be overridden by adding an the optional leading + to a refspec (or using --force command line option). The only exception to this is that no amount of forcing will make the refs/heads/* namespace accept a non-commit object. Note When the remote branch you want to fetch is known to be rewound and rebased regularly, it is expected that its new tip will not be descendant of its previous tip (as stored in your remote-tracking branch the last time you fetched). You would want to use the + sign to indicate non-fast-forward updates will be needed for such branches. There is no way to determine or declare that a branch will be made available in a repository with this behavior; the pulling user simply must know this is the expected usage pattern for a branch."
            },
            {
                "flag": "",
                "long": "--stdin",
                "arg": null,
                "description": "Read refspecs, one per line, from stdin in addition to those provided as arguments. The \"tag <name>\" format is not supported."
            }
        ],
        "examples": [
            "•   Update the remote-tracking branches:",
            "$ git fetch origin",
            "The above command copies all branches from the remote refs/heads/ namespace and stores",
            "them to the local refs/remotes/origin/ namespace, unless the branch.<name>.fetch option",
            "is used to specify a non-default refspec.",
            "•   Using refspecs explicitly:",
            "$ git fetch origin +seen:seen maint:tmp",
            "This updates (or creates, as necessary) branches seen and tmp in the local repository by",
            "fetching from the branches (respectively) seen and maint from the remote repository.",
            "The seen branch will be updated even if it does not fast-forward, because it is prefixed",
            "with a plus sign; tmp will not be.",
            "•   Peek at a remote’s branch, without configuring the remote in your local repository:",
            "$ git fetch git://git.kernel.org/pub/scm/git/git.git maint",
            "$ git log FETCHHEAD",
            "The first command fetches the maint branch from the repository at",
            "git://git.kernel.org/pub/scm/git/git.git and the second command uses FETCHHEAD to",
            "examine the branch with git-log(1). The fetched objects will eventually be removed by",
            "git’s built-in housekeeping (see git-gc(1))."
        ],
        "see_also": [
            {
                "name": "git-pull",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/git-pull/1/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 21,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "--all",
                        "lines": 2,
                        "long": "--all"
                    },
                    {
                        "name": "-a, --append",
                        "lines": 3,
                        "flag": "-a",
                        "long": "--append"
                    },
                    {
                        "name": "--atomic",
                        "lines": 21,
                        "long": "--atomic"
                    },
                    {
                        "name": "--unshallow",
                        "lines": 6,
                        "long": "--unshallow"
                    },
                    {
                        "name": "--update-shallow",
                        "lines": 20,
                        "long": "--update-shallow"
                    },
                    {
                        "name": "--negotiate-only",
                        "lines": 5,
                        "long": "--negotiate-only"
                    },
                    {
                        "name": "--dry-run",
                        "lines": 7,
                        "long": "--dry-run"
                    },
                    {
                        "name": "-f, --force",
                        "lines": 3,
                        "flag": "-f",
                        "long": "--force"
                    },
                    {
                        "name": "-k, --keep",
                        "lines": 2,
                        "flag": "-k",
                        "long": "--keep"
                    },
                    {
                        "name": "--multiple",
                        "lines": 11,
                        "long": "--multiple"
                    },
                    {
                        "name": "--prefetch",
                        "lines": 3,
                        "long": "--prefetch"
                    },
                    {
                        "name": "-p, --prune",
                        "lines": 9,
                        "flag": "-p",
                        "long": "--prune"
                    },
                    {
                        "name": "-P, --prune-tags",
                        "lines": 8,
                        "flag": "-P",
                        "long": "--prune-tags"
                    },
                    {
                        "name": "-n, --no-tags",
                        "lines": 13,
                        "flag": "-n",
                        "long": "--no-tags"
                    },
                    {
                        "name": "-t, --tags",
                        "lines": 5,
                        "flag": "-t",
                        "long": "--tags"
                    },
                    {
                        "name": "--recurse-submodules[=yes|on-demand|no]",
                        "lines": 20
                    },
                    {
                        "name": "--no-recurse-submodules",
                        "lines": 3,
                        "long": "--no-recurse-submodules"
                    },
                    {
                        "name": "--set-upstream",
                        "lines": 14,
                        "long": "--set-upstream"
                    },
                    {
                        "name": "-u, --update-head-ok",
                        "lines": 5,
                        "flag": "-u",
                        "long": "--update-head-ok"
                    },
                    {
                        "name": "--upload-pack <upload-pack>",
                        "lines": 4,
                        "long": "--upload-pack",
                        "arg": "<upload-pack>"
                    },
                    {
                        "name": "-q, --quiet",
                        "lines": 3,
                        "flag": "-q",
                        "long": "--quiet"
                    },
                    {
                        "name": "-v, --verbose",
                        "lines": 2,
                        "flag": "-v",
                        "long": "--verbose"
                    },
                    {
                        "name": "--progress",
                        "lines": 11,
                        "long": "--progress"
                    },
                    {
                        "name": "--show-forced-updates",
                        "lines": 4,
                        "long": "--show-forced-updates"
                    },
                    {
                        "name": "--no-show-forced-updates",
                        "lines": 84,
                        "long": "--no-show-forced-updates"
                    },
                    {
                        "name": "--stdin",
                        "lines": 3,
                        "long": "--stdin"
                    }
                ]
            },
            {
                "name": "GIT URLS",
                "lines": 91,
                "subsections": []
            },
            {
                "name": "REMOTES",
                "lines": 11,
                "subsections": [
                    {
                        "name": "Named remote in configuration file",
                        "lines": 51
                    }
                ]
            },
            {
                "name": "CONFIGURED REMOTE-TRACKING BRANCHES",
                "lines": 33,
                "subsections": []
            },
            {
                "name": "PRUNING",
                "lines": 6,
                "subsections": [
                    {
                        "name": "-a --contains",
                        "lines": 59,
                        "flag": "-a",
                        "long": "--contains"
                    }
                ]
            },
            {
                "name": "OUTPUT",
                "lines": 56,
                "subsections": []
            },
            {
                "name": "EXAMPLES",
                "lines": 28,
                "subsections": []
            },
            {
                "name": "SECURITY",
                "lines": 25,
                "subsections": []
            },
            {
                "name": "BUGS",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "GIT",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "git-fetch - Download objects and refs from another repository\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "git fetch [<options>] [<repository> [<refspec>...]]\ngit fetch [<options>] <group>\ngit fetch --multiple [<options>] [(<repository> | <group>)...]\ngit fetch --all [<options>]\n\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "Fetch branches and/or tags (collectively, \"refs\") from one or more other repositories, along\nwith the objects necessary to complete their histories. Remote-tracking branches are updated\n(see the description of <refspec> below for ways to control this behavior).\n\nBy default, any tag that points into the histories being fetched is also fetched; the effect\nis to fetch tags that point at branches that you are interested in. This default behavior can\nbe changed by using the --tags or --no-tags options or by configuring remote.<name>.tagOpt.\nBy using a refspec that fetches tags explicitly, you can fetch tags that do not point into\nbranches you are interested in as well.\n\ngit fetch can fetch from either a single named repository or URL, or from several\nrepositories at once if <group> is given and there is a remotes.<group> entry in the\nconfiguration file. (See git-config(1)).\n\nWhen no remote is specified, by default the origin remote will be used, unless there’s an\nupstream branch configured for the current branch.\n\nThe names of refs that are fetched, together with the object names they point at, are written\nto .git/FETCHHEAD. This information may be used by scripts or other git commands, such as\ngit-pull(1).\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "--all",
                        "content": "Fetch all remotes.\n",
                        "long": "--all"
                    },
                    {
                        "name": "-a, --append",
                        "content": "Append ref names and object names of fetched refs to the existing contents of\n.git/FETCHHEAD. Without this option old data in .git/FETCHHEAD will be overwritten.\n",
                        "flag": "-a",
                        "long": "--append"
                    },
                    {
                        "name": "--atomic",
                        "content": "Use an atomic transaction to update local refs. Either all refs are updated, or on error,\nno refs are updated.\n\n--depth=<depth>\nLimit fetching to the specified number of commits from the tip of each remote branch\nhistory. If fetching to a shallow repository created by git clone with --depth=<depth>\noption (see git-clone(1)), deepen or shorten the history to the specified number of\ncommits. Tags for the deepened commits are not fetched.\n\n--deepen=<depth>\nSimilar to --depth, except it specifies the number of commits from the current shallow\nboundary instead of from the tip of each remote branch history.\n\n--shallow-since=<date>\nDeepen or shorten the history of a shallow repository to include all reachable commits\nafter <date>.\n\n--shallow-exclude=<revision>\nDeepen or shorten the history of a shallow repository to exclude commits reachable from a\nspecified remote branch or tag. This option can be specified multiple times.\n",
                        "long": "--atomic"
                    },
                    {
                        "name": "--unshallow",
                        "content": "If the source repository is complete, convert a shallow repository to a complete one,\nremoving all the limitations imposed by shallow repositories.\n\nIf the source repository is shallow, fetch as much as possible so that the current\nrepository has the same history as the source repository.\n",
                        "long": "--unshallow"
                    },
                    {
                        "name": "--update-shallow",
                        "content": "By default when fetching from a shallow repository, git fetch refuses refs that require\nupdating .git/shallow. This option updates .git/shallow and accept such refs.\n\n--negotiation-tip=<commit|glob>\nBy default, Git will report, to the server, commits reachable from all local refs to find\ncommon commits in an attempt to reduce the size of the to-be-received packfile. If\nspecified, Git will only report commits reachable from the given tips. This is useful to\nspeed up fetches when the user knows which local ref is likely to have commits in common\nwith the upstream ref being fetched.\n\nThis option may be specified more than once; if so, Git will report commits reachable\nfrom any of the given commits.\n\nThe argument to this option may be a glob on ref names, a ref, or the (possibly\nabbreviated) SHA-1 of a commit. Specifying a glob is equivalent to specifying this option\nmultiple times, one for each matching ref name.\n\nSee also the fetch.negotiationAlgorithm and push.negotiate configuration variables\ndocumented in git-config(1), and the --negotiate-only option below.\n",
                        "long": "--update-shallow"
                    },
                    {
                        "name": "--negotiate-only",
                        "content": "Do not fetch anything from the server, and instead print the ancestors of the provided\n--negotiation-tip=* arguments, which we have in common with the server.\n\nInternally this is used to implement the push.negotiate option, see git-config(1).\n",
                        "long": "--negotiate-only"
                    },
                    {
                        "name": "--dry-run",
                        "content": "Show what would be done, without making any changes.\n\n--[no-]write-fetch-head\nWrite the list of remote refs fetched in the FETCHHEAD file directly under $GITDIR.\nThis is the default. Passing --no-write-fetch-head from the command line tells Git not to\nwrite the file. Under --dry-run option, the file is never written.\n",
                        "long": "--dry-run"
                    },
                    {
                        "name": "-f, --force",
                        "content": "When git fetch is used with <src>:<dst> refspec it may refuse to update the local branch\nas discussed in the <refspec> part below. This option overrides that check.\n",
                        "flag": "-f",
                        "long": "--force"
                    },
                    {
                        "name": "-k, --keep",
                        "content": "Keep downloaded pack.\n",
                        "flag": "-k",
                        "long": "--keep"
                    },
                    {
                        "name": "--multiple",
                        "content": "Allow several <repository> and <group> arguments to be specified. No <refspec>s may be\nspecified.\n\n--[no-]auto-maintenance, --[no-]auto-gc\nRun git maintenance run --auto at the end to perform automatic repository maintenance if\nneeded. (--[no-]auto-gc is a synonym.) This is enabled by default.\n\n--[no-]write-commit-graph\nWrite a commit-graph after fetching. This overrides the config setting\nfetch.writeCommitGraph.\n",
                        "long": "--multiple"
                    },
                    {
                        "name": "--prefetch",
                        "content": "Modify the configured refspec to place all refs into the refs/prefetch/ namespace. See\nthe prefetch task in git-maintenance(1).\n",
                        "long": "--prefetch"
                    },
                    {
                        "name": "-p, --prune",
                        "content": "Before fetching, remove any remote-tracking references that no longer exist on the\nremote. Tags are not subject to pruning if they are fetched only because of the default\ntag auto-following or due to a --tags option. However, if tags are fetched due to an\nexplicit refspec (either on the command line or in the remote configuration, for example\nif the remote was cloned with the --mirror option), then they are also subject to\npruning. Supplying --prune-tags is a shorthand for providing the tag refspec.\n\nSee the PRUNING section below for more details.\n",
                        "flag": "-p",
                        "long": "--prune"
                    },
                    {
                        "name": "-P, --prune-tags",
                        "content": "Before fetching, remove any local tags that no longer exist on the remote if --prune is\nenabled. This option should be used more carefully, unlike --prune it will remove any\nlocal references (local tags) that have been created. This option is a shorthand for\nproviding the explicit tag refspec along with --prune, see the discussion about that in\nits documentation.\n\nSee the PRUNING section below for more details.\n",
                        "flag": "-P",
                        "long": "--prune-tags"
                    },
                    {
                        "name": "-n, --no-tags",
                        "content": "By default, tags that point at objects that are downloaded from the remote repository are\nfetched and stored locally. This option disables this automatic tag following. The\ndefault behavior for a remote may be specified with the remote.<name>.tagOpt setting. See\ngit-config(1).\n\n--refmap=<refspec>\nWhen fetching refs listed on the command line, use the specified refspec (can be given\nmore than once) to map the refs to remote-tracking branches, instead of the values of\nremote.*.fetch configuration variables for the remote repository. Providing an empty\n<refspec> to the --refmap option causes Git to ignore the configured refspecs and rely\nentirely on the refspecs supplied as command-line arguments. See section on \"Configured\nRemote-tracking Branches\" for details.\n",
                        "flag": "-n",
                        "long": "--no-tags"
                    },
                    {
                        "name": "-t, --tags",
                        "content": "Fetch all tags from the remote (i.e., fetch remote tags refs/tags/* into local tags with\nthe same name), in addition to whatever else would otherwise be fetched. Using this\noption alone does not subject tags to pruning, even if --prune is used (though tags may\nbe pruned anyway if they are also the destination of an explicit refspec; see --prune).\n",
                        "flag": "-t",
                        "long": "--tags"
                    },
                    {
                        "name": "--recurse-submodules[=yes|on-demand|no]",
                        "content": "This option controls if and under what conditions new commits of populated submodules\nshould be fetched too. It can be used as a boolean option to completely disable recursion\nwhen set to no or to unconditionally recurse into all populated submodules when set to\nyes, which is the default when this option is used without any value. Use on-demand to\nonly recurse into a populated submodule when the superproject retrieves a commit that\nupdates the submodule’s reference to a commit that isn’t already in the local submodule\nclone. By default, on-demand is used, unless fetch.recurseSubmodules is set (see git-\nconfig(1)).\n\n-j, --jobs=<n>\nNumber of parallel children to be used for all forms of fetching.\n\nIf the --multiple option was specified, the different remotes will be fetched in\nparallel. If multiple submodules are fetched, they will be fetched in parallel. To\ncontrol them independently, use the config settings fetch.parallel and\nsubmodule.fetchJobs (see git-config(1)).\n\nTypically, parallel recursive and multi-remote fetches will be faster. By default fetches\nare performed sequentially, not in parallel.\n"
                    },
                    {
                        "name": "--no-recurse-submodules",
                        "content": "Disable recursive fetching of submodules (this has the same effect as using the\n--recurse-submodules=no option).\n",
                        "long": "--no-recurse-submodules"
                    },
                    {
                        "name": "--set-upstream",
                        "content": "If the remote is fetched successfully, add upstream (tracking) reference, used by\nargument-less git-pull(1) and other commands. For more information, see\nbranch.<name>.merge and branch.<name>.remote in git-config(1).\n\n--submodule-prefix=<path>\nPrepend <path> to paths printed in informative messages such as \"Fetching submodule foo\".\nThis option is used internally when recursing over submodules.\n\n--recurse-submodules-default=[yes|on-demand]\nThis option is used internally to temporarily provide a non-negative default value for\nthe --recurse-submodules option. All other methods of configuring fetch’s submodule\nrecursion (such as settings in gitmodules(5) and git-config(1)) override this option, as\ndoes specifying --[no-]recurse-submodules directly.\n",
                        "long": "--set-upstream"
                    },
                    {
                        "name": "-u, --update-head-ok",
                        "content": "By default git fetch refuses to update the head which corresponds to the current branch.\nThis flag disables the check. This is purely for the internal use for git pull to\ncommunicate with git fetch, and unless you are implementing your own Porcelain you are\nnot supposed to use it.\n",
                        "flag": "-u",
                        "long": "--update-head-ok"
                    },
                    {
                        "name": "--upload-pack <upload-pack>",
                        "content": "When given, and the repository to fetch from is handled by git fetch-pack,\n--exec=<upload-pack> is passed to the command to specify non-default path for the command\nrun on the other end.\n",
                        "long": "--upload-pack",
                        "arg": "<upload-pack>"
                    },
                    {
                        "name": "-q, --quiet",
                        "content": "Pass --quiet to git-fetch-pack and silence any other internally used git commands.\nProgress is not reported to the standard error stream.\n",
                        "flag": "-q",
                        "long": "--quiet"
                    },
                    {
                        "name": "-v, --verbose",
                        "content": "Be verbose.\n",
                        "flag": "-v",
                        "long": "--verbose"
                    },
                    {
                        "name": "--progress",
                        "content": "Progress status is reported on the standard error stream by default when it is attached\nto a terminal, unless -q is specified. This flag forces progress status even if the\nstandard error stream is not directed to a terminal.\n\n-o <option>, --server-option=<option>\nTransmit the given string to the server when communicating using protocol version 2. The\ngiven string must not contain a NUL or LF character. The server’s handling of server\noptions, including unknown ones, is server-specific. When multiple\n--server-option=<option> are given, they are all sent to the other side in the order\nlisted on the command line.\n",
                        "long": "--progress"
                    },
                    {
                        "name": "--show-forced-updates",
                        "content": "By default, git checks if a branch is force-updated during fetch. This can be disabled\nthrough fetch.showForcedUpdates, but the --show-forced-updates option guarantees this\ncheck occurs. See git-config(1).\n",
                        "long": "--show-forced-updates"
                    },
                    {
                        "name": "--no-show-forced-updates",
                        "content": "By default, git checks if a branch is force-updated during fetch. Pass\n--no-show-forced-updates or set fetch.showForcedUpdates to false to skip this check for\nperformance reasons. If used during git-pull the --ff-only option will still check for\nforced updates before attempting a fast-forward update. See git-config(1).\n\n-4, --ipv4\nUse IPv4 addresses only, ignoring IPv6 addresses.\n\n-6, --ipv6\nUse IPv6 addresses only, ignoring IPv4 addresses.\n\n<repository>\nThe \"remote\" repository that is the source of a fetch or pull operation. This parameter\ncan be either a URL (see the section GIT URLS below) or the name of a remote (see the\nsection REMOTES below).\n\n<group>\nA name referring to a list of repositories as the value of remotes.<group> in the\nconfiguration file. (See git-config(1)).\n\n<refspec>\nSpecifies which refs to fetch and which local refs to update. When no <refspec>s appear\non the command line, the refs to fetch are read from remote.<repository>.fetch variables\ninstead (see CONFIGURED REMOTE-TRACKING BRANCHES below).\n\nThe format of a <refspec> parameter is an optional plus +, followed by the source <src>,\nfollowed by a colon :, followed by the destination ref <dst>. The colon can be omitted\nwhen <dst> is empty. <src> is typically a ref, but it can also be a fully spelled hex\nobject name.\n\nA <refspec> may contain a * in its <src> to indicate a simple pattern match. Such a\nrefspec functions like a glob that matches any ref with the same prefix. A pattern\n<refspec> must have a * in both the <src> and <dst>. It will map refs to the destination\nby replacing the * with the contents matched from the source.\n\nIf a refspec is prefixed by ^, it will be interpreted as a negative refspec. Rather than\nspecifying which refs to fetch or which local refs to update, such a refspec will instead\nspecify refs to exclude. A ref will be considered to match if it matches at least one\npositive refspec, and does not match any negative refspec. Negative refspecs can be\nuseful to restrict the scope of a pattern refspec so that it will not include specific\nrefs. Negative refspecs can themselves be pattern refspecs. However, they may only\ncontain a <src> and do not specify a <dst>. Fully spelled out hex object names are also\nnot supported.\n\ntag <tag> means the same as refs/tags/<tag>:refs/tags/<tag>; it requests fetching\neverything up to the given tag.\n\nThe remote ref that matches <src> is fetched, and if <dst> is not an empty string, an\nattempt is made to update the local ref that matches it.\n\nWhether that update is allowed without --force depends on the ref namespace it’s being\nfetched to, the type of object being fetched, and whether the update is considered to be\na fast-forward. Generally, the same rules apply for fetching as when pushing, see the\n<refspec>...  section of git-push(1) for what those are. Exceptions to those rules\nparticular to git fetch are noted below.\n\nUntil Git version 2.20, and unlike when pushing with git-push(1), any updates to\nrefs/tags/* would be accepted without + in the refspec (or --force). When fetching, we\npromiscuously considered all tag updates from a remote to be forced fetches. Since Git\nversion 2.20, fetching to update refs/tags/* works the same way as when pushing. I.e. any\nupdates will be rejected without + in the refspec (or --force).\n\nUnlike when pushing with git-push(1), any updates outside of refs/{tags,heads}/* will be\naccepted without + in the refspec (or --force), whether that’s swapping e.g. a tree\nobject for a blob, or a commit for another commit that’s doesn’t have the previous commit\nas an ancestor etc.\n\nUnlike when pushing with git-push(1), there is no configuration which’ll amend these\nrules, and nothing like a pre-fetch hook analogous to the pre-receive hook.\n\nAs with pushing with git-push(1), all of the rules described above about what’s not\nallowed as an update can be overridden by adding an the optional leading + to a refspec\n(or using --force command line option). The only exception to this is that no amount of\nforcing will make the refs/heads/* namespace accept a non-commit object.\n\nNote\nWhen the remote branch you want to fetch is known to be rewound and rebased\nregularly, it is expected that its new tip will not be descendant of its previous tip\n(as stored in your remote-tracking branch the last time you fetched). You would want\nto use the + sign to indicate non-fast-forward updates will be needed for such\nbranches. There is no way to determine or declare that a branch will be made\navailable in a repository with this behavior; the pulling user simply must know this\nis the expected usage pattern for a branch.\n",
                        "long": "--no-show-forced-updates"
                    },
                    {
                        "name": "--stdin",
                        "content": "Read refspecs, one per line, from stdin in addition to those provided as arguments. The\n\"tag <name>\" format is not supported.\n",
                        "long": "--stdin"
                    }
                ]
            },
            "GIT URLS": {
                "content": "In general, URLs contain information about the transport protocol, the address of the remote\nserver, and the path to the repository. Depending on the transport protocol, some of this\ninformation may be absent.\n\nGit supports ssh, git, http, and https protocols (in addition, ftp, and ftps can be used for\nfetching, but this is inefficient and deprecated; do not use it).\n\nThe native transport (i.e. git:// URL) does no authentication and should be used with caution\non unsecured networks.\n\nThe following syntaxes may be used with them:\n\n•   ssh://[user@]host.xz[:port]/path/to/repo.git/\n\n•   git://host.xz[:port]/path/to/repo.git/\n\n•   http[s]://host.xz[:port]/path/to/repo.git/\n\n•   ftp[s]://host.xz[:port]/path/to/repo.git/\n\nAn alternative scp-like syntax may also be used with the ssh protocol:\n\n•   [user@]host.xz:path/to/repo.git/\n\nThis syntax is only recognized if there are no slashes before the first colon. This helps\ndifferentiate a local path that contains a colon. For example the local path foo:bar could be\nspecified as an absolute path or ./foo:bar to avoid being misinterpreted as an ssh url.\n\nThe ssh and git protocols additionally support ~username expansion:\n\n•   ssh://[user@]host.xz[:port]/~[user]/path/to/repo.git/\n\n•   git://host.xz[:port]/~[user]/path/to/repo.git/\n\n•   [user@]host.xz:/~[user]/path/to/repo.git/\n\nFor local repositories, also supported by Git natively, the following syntaxes may be used:\n\n•   /path/to/repo.git/\n\n•   file:///path/to/repo.git/\n\nThese two syntaxes are mostly equivalent, except when cloning, when the former implies\n--local option. See git-clone(1) for details.\n\ngit clone, git fetch and git pull, but not git push, will also accept a suitable bundle file.\nSee git-bundle(1).\n\nWhen Git doesn’t know how to handle a certain transport protocol, it attempts to use the\nremote-<transport> remote helper, if one exists. To explicitly request a remote helper, the\nfollowing syntax may be used:\n\n•   <transport>::<address>\n\nwhere <address> may be a path, a server and path, or an arbitrary URL-like string recognized\nby the specific remote helper being invoked. See gitremote-helpers(7) for details.\n\nIf there are a large number of similarly-named remote repositories and you want to use a\ndifferent format for them (such that the URLs you use will be rewritten into URLs that work),\nyou can create a configuration section of the form:\n\n[url \"<actual url base>\"]\ninsteadOf = <other url base>\n\n\nFor example, with this:\n\n[url \"git://git.host.xz/\"]\ninsteadOf = host.xz:/path/to/\ninsteadOf = work:\n\n\na URL like \"work:repo.git\" or like \"host.xz:/path/to/repo.git\" will be rewritten in any\ncontext that takes a URL to be \"git://git.host.xz/repo.git\".\n\nIf you want to rewrite URLs for push only, you can create a configuration section of the\nform:\n\n[url \"<actual url base>\"]\npushInsteadOf = <other url base>\n\n\nFor example, with this:\n\n[url \"ssh://example.org/\"]\npushInsteadOf = git://example.org/\n\n\na URL like \"git://example.org/path/to/repo.git\" will be rewritten to\n\"ssh://example.org/path/to/repo.git\" for pushes, but pulls will still use the original URL.\n",
                "subsections": []
            },
            "REMOTES": {
                "content": "The name of one of the following can be used instead of a URL as <repository> argument:\n\n•   a remote in the Git configuration file: $GITDIR/config,\n\n•   a file in the $GITDIR/remotes directory, or\n\n•   a file in the $GITDIR/branches directory.\n\nAll of these also allow you to omit the refspec from the command line because they each\ncontain a refspec which git will use by default.\n",
                "subsections": [
                    {
                        "name": "Named remote in configuration file",
                        "content": "You can choose to provide the name of a remote which you had previously configured using git-\nremote(1), git-config(1) or even by a manual edit to the $GITDIR/config file. The URL of\nthis remote will be used to access the repository. The refspec of this remote will be used by\ndefault when you do not provide a refspec on the command line. The entry in the config file\nwould appear like this:\n\n[remote \"<name>\"]\nurl = <url>\npushurl = <pushurl>\npush = <refspec>\nfetch = <refspec>\n\n\nThe <pushurl> is used for pushes only. It is optional and defaults to <url>.\n\nNamed file in $GITDIR/remotes\nYou can choose to provide the name of a file in $GITDIR/remotes. The URL in this file will\nbe used to access the repository. The refspec in this file will be used as default when you\ndo not provide a refspec on the command line. This file should have the following format:\n\nURL: one of the above URL format\nPush: <refspec>\nPull: <refspec>\n\n\nPush: lines are used by git push and Pull: lines are used by git pull and git fetch. Multiple\nPush: and Pull: lines may be specified for additional branch mappings.\n\nNamed file in $GITDIR/branches\nYou can choose to provide the name of a file in $GITDIR/branches. The URL in this file will\nbe used to access the repository. This file should have the following format:\n\n<url>#<head>\n\n\n<url> is required; #<head> is optional.\n\nDepending on the operation, git will use one of the following refspecs, if you don’t provide\none on the command line. <branch> is the name of this file in $GITDIR/branches and <head>\ndefaults to master.\n\ngit fetch uses:\n\nrefs/heads/<head>:refs/heads/<branch>\n\n\ngit push uses:\n\nHEAD:refs/heads/<head>\n\n"
                    }
                ]
            },
            "CONFIGURED REMOTE-TRACKING BRANCHES": {
                "content": "You often interact with the same remote repository by regularly and repeatedly fetching from\nit. In order to keep track of the progress of such a remote repository, git fetch allows you\nto configure remote.<repository>.fetch configuration variables.\n\nTypically such a variable may look like this:\n\n[remote \"origin\"]\nfetch = +refs/heads/*:refs/remotes/origin/*\n\n\nThis configuration is used in two ways:\n\n•   When git fetch is run without specifying what branches and/or tags to fetch on the\ncommand line, e.g.  git fetch origin or git fetch, remote.<repository>.fetch values are\nused as the refspecs—they specify which refs to fetch and which local refs to update. The\nexample above will fetch all branches that exist in the origin (i.e. any ref that matches\nthe left-hand side of the value, refs/heads/*) and update the corresponding\nremote-tracking branches in the refs/remotes/origin/* hierarchy.\n\n•   When git fetch is run with explicit branches and/or tags to fetch on the command line,\ne.g.  git fetch origin master, the <refspec>s given on the command line determine what\nare to be fetched (e.g.  master in the example, which is a short-hand for master:, which\nin turn means \"fetch the master branch but I do not explicitly say what remote-tracking\nbranch to update with it from the command line\"), and the example command will fetch only\nthe master branch. The remote.<repository>.fetch values determine which remote-tracking\nbranch, if any, is updated. When used in this way, the remote.<repository>.fetch values\ndo not have any effect in deciding what gets fetched (i.e. the values are not used as\nrefspecs when the command-line lists refspecs); they are only used to decide where the\nrefs that are fetched are stored by acting as a mapping.\n\nThe latter use of the remote.<repository>.fetch values can be overridden by giving the\n--refmap=<refspec> parameter(s) on the command line.\n",
                "subsections": []
            },
            "PRUNING": {
                "content": "Git has a default disposition of keeping data unless it’s explicitly thrown away; this\nextends to holding onto local references to branches on remotes that have themselves deleted\nthose branches.\n\nIf left to accumulate, these stale references might make performance worse on big and busy\nrepos that have a lot of branch churn, and e.g. make the output of commands like git branch",
                "subsections": [
                    {
                        "name": "-a --contains",
                        "content": "with the complete set of known references.\n\nThese remote-tracking references can be deleted as a one-off with either of:\n\n# While fetching\n$ git fetch --prune <name>\n\n# Only prune, don't fetch\n$ git remote prune <name>\n\n\nTo prune references as part of your normal workflow without needing to remember to run that,\nset fetch.prune globally, or remote.<name>.prune per-remote in the config. See git-config(1).\n\nHere’s where things get tricky and more specific. The pruning feature doesn’t actually care\nabout branches, instead it’ll prune local ←→ remote-references as a function of the refspec\nof the remote (see <refspec> and CONFIGURED REMOTE-TRACKING BRANCHES above).\n\nTherefore if the refspec for the remote includes e.g. refs/tags/*:refs/tags/*, or you\nmanually run e.g. git fetch --prune <name> \"refs/tags/*:refs/tags/*\" it won’t be stale remote\ntracking branches that are deleted, but any local tag that doesn’t exist on the remote.\n\nThis might not be what you expect, i.e. you want to prune remote <name>, but also explicitly\nfetch tags from it, so when you fetch from it you delete all your local tags, most of which\nmay not have come from the <name> remote in the first place.\n\nSo be careful when using this with a refspec like refs/tags/*:refs/tags/*, or any other\nrefspec which might map references from multiple remotes to the same local namespace.\n\nSince keeping up-to-date with both branches and tags on the remote is a common use-case the\n--prune-tags option can be supplied along with --prune to prune local tags that don’t exist\non the remote, and force-update those tags that differ. Tag pruning can also be enabled with\nfetch.pruneTags or remote.<name>.pruneTags in the config. See git-config(1).\n\nThe --prune-tags option is equivalent to having refs/tags/*:refs/tags/* declared in the\nrefspecs of the remote. This can lead to some seemingly strange interactions:\n\n# These both fetch tags\n$ git fetch --no-tags origin 'refs/tags/*:refs/tags/*'\n$ git fetch --no-tags --prune-tags origin\n\n\nThe reason it doesn’t error out when provided without --prune or its config versions is for\nflexibility of the configured versions, and to maintain a 1=1 mapping between what the\ncommand line flags do, and what the configuration versions do.\n\nIt’s reasonable to e.g. configure fetch.pruneTags=true in ~/.gitconfig to have tags pruned\nwhenever git fetch --prune is run, without making every invocation of git fetch without\n--prune an error.\n\nPruning tags with --prune-tags also works when fetching a URL instead of a named remote.\nThese will all prune tags not found on origin:\n\n$ git fetch origin --prune --prune-tags\n$ git fetch origin --prune 'refs/tags/*:refs/tags/*'\n$ git fetch <url of origin> --prune --prune-tags\n$ git fetch <url of origin> --prune 'refs/tags/*:refs/tags/*'\n\n",
                        "flag": "-a",
                        "long": "--contains"
                    }
                ]
            },
            "OUTPUT": {
                "content": "The output of \"git fetch\" depends on the transport method used; this section describes the\noutput when fetching over the Git protocol (either locally or via ssh) and Smart HTTP\nprotocol.\n\nThe status of the fetch is output in tabular form, with each line representing the status of\na single ref. Each line is of the form:\n\n<flag> <summary> <from> -> <to> [<reason>]\n\n\nThe status of up-to-date refs is shown only if the --verbose option is used.\n\nIn compact output mode, specified with configuration variable fetch.output, if either entire\n<from> or <to> is found in the other string, it will be substituted with * in the other\nstring. For example, master -> origin/master becomes master -> origin/*.\n\nflag\nA single character indicating the status of the ref:\n\n(space)\nfor a successfully fetched fast-forward;\n\n+\nfor a successful forced update;\n\n-\nfor a successfully pruned ref;\n\nt\nfor a successful tag update;\n\n*\nfor a successfully fetched new ref;\n\n!\nfor a ref that was rejected or failed to update; and\n\n=\nfor a ref that was up to date and did not need fetching.\n\nsummary\nFor a successfully fetched ref, the summary shows the old and new values of the ref in a\nform suitable for using as an argument to git log (this is <old>..<new> in most cases,\nand <old>...<new> for forced non-fast-forward updates).\n\nfrom\nThe name of the remote ref being fetched from, minus its refs/<type>/ prefix. In the case\nof deletion, the name of the remote ref is \"(none)\".\n\nto\nThe name of the local ref being updated, minus its refs/<type>/ prefix.\n\nreason\nA human-readable explanation. In the case of successfully fetched refs, no explanation is\nneeded. For a failed ref, the reason for failure is described.\n",
                "subsections": []
            },
            "EXAMPLES": {
                "content": "•   Update the remote-tracking branches:\n\n$ git fetch origin\n\nThe above command copies all branches from the remote refs/heads/ namespace and stores\nthem to the local refs/remotes/origin/ namespace, unless the branch.<name>.fetch option\nis used to specify a non-default refspec.\n\n•   Using refspecs explicitly:\n\n$ git fetch origin +seen:seen maint:tmp\n\nThis updates (or creates, as necessary) branches seen and tmp in the local repository by\nfetching from the branches (respectively) seen and maint from the remote repository.\n\nThe seen branch will be updated even if it does not fast-forward, because it is prefixed\nwith a plus sign; tmp will not be.\n\n•   Peek at a remote’s branch, without configuring the remote in your local repository:\n\n$ git fetch git://git.kernel.org/pub/scm/git/git.git maint\n$ git log FETCHHEAD\n\nThe first command fetches the maint branch from the repository at\ngit://git.kernel.org/pub/scm/git/git.git and the second command uses FETCHHEAD to\nexamine the branch with git-log(1). The fetched objects will eventually be removed by\ngit’s built-in housekeeping (see git-gc(1)).\n",
                "subsections": []
            },
            "SECURITY": {
                "content": "The fetch and push protocols are not designed to prevent one side from stealing data from the\nother repository that was not intended to be shared. If you have private data that you need\nto protect from a malicious peer, your best option is to store it in another repository. This\napplies to both clients and servers. In particular, namespaces on a server are not effective\nfor read access control; you should only grant read access to a namespace to clients that you\nwould trust with read access to the entire repository.\n\nThe known attack vectors are as follows:\n\n1. The victim sends \"have\" lines advertising the IDs of objects it has that are not\nexplicitly intended to be shared but can be used to optimize the transfer if the peer\nalso has them. The attacker chooses an object ID X to steal and sends a ref to X, but\nisn’t required to send the content of X because the victim already has it. Now the victim\nbelieves that the attacker has X, and it sends the content of X back to the attacker\nlater. (This attack is most straightforward for a client to perform on a server, by\ncreating a ref to X in the namespace the client has access to and then fetching it. The\nmost likely way for a server to perform it on a client is to \"merge\" X into a public\nbranch and hope that the user does additional work on this branch and pushes it back to\nthe server without noticing the merge.)\n\n2. As in #1, the attacker chooses an object ID X to steal. The victim sends an object Y that\nthe attacker already has, and the attacker falsely claims to have X and not Y, so the\nvictim sends Y as a delta against X. The delta reveals regions of X that are similar to Y\nto the attacker.\n",
                "subsections": []
            },
            "BUGS": {
                "content": "Using --recurse-submodules can only fetch new commits in already checked out submodules right\nnow. When e.g. upstream added a new submodule in the just fetched commits of the superproject\nthe submodule itself cannot be fetched, making it impossible to check out that submodule\nlater without having to do a fetch again. This is expected to be fixed in a future Git\nversion.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "git-pull(1)\n",
                "subsections": []
            },
            "GIT": {
                "content": "Part of the git(1) suite\n\n\n\nGit 2.34.1                                   02/26/2026                                 GIT-FETCH(1)",
                "subsections": []
            }
        }
    }
}