git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git fetch automatic tag fetching - confusing when on or off

From
Ondra Medek <xmedeko@gmail.com>
Date
Jul 9, 2026, 07:33 UTC
Message-ID
<CAJsoDaFJLk5d7awSR1t6C7+F6d_1gv+qQCQHKzb_YA6dZzXfQA@mail.gmail.com>

Hi, In git fetch documentation https://git-scm.com/docs/git-fetch is:

> By default, any tag that points into the histories being fetched is also fetched; the effect is to fetch tags that point at branches that you are interested in. This default behavior can be changed by using the --tags or --no-tags options or by configuring remote.<name>.tagOpt.

However, sometimes this automatic tag fetching works and sometimes not and it's mentioned in docs when and why. See the following examples. (I have no any git config setting regarding tag fetching set).

All these commands DO NOT automatically fetch tags:

git fetch origin master git fetch origin master: git fetch origin refs/heads/master git fetch origin refs/heads/master:

While specifying :dst part of refspec DOES automatic tags fetching:
git fetch origin refs/heads/master:refs/remotes/origin/master

What is even more confusing (or maybe a bug), adding a nonexistent refs prefix (i.e. with no real refs in local or remote repository) DOES tags fetching even for "master" branch:

git fetch origin master refs/none/*:refs/none/*

So, it seems to me any refspec with :dst part triggers automatic tag fetching for all refspecs? Please, document (or fix) this behaviour.

Note: I've prepared tests with
git tag tagTest master
git push --tags origin
And deleted local tag before each test
git tag -d tagTest

Thanks and best regards Ondřej Medek

Message 1 of 1 in “git fetch automatic tag fetching - confusing when on or off”
  1. Ondra MedekJul 9, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.