Volume XXII, number 279Tuesday, October 6, 2026Latest message 49 minutes ago

The Git List

News and archive of git@vger.kernel.org, since April 2005

git fetch automatic tag fetching - confusing when on or off

1 messages between Jul 9, 2026 and Jul 9, 2026, from Ondra Medek.

Plain Markdown or JSON for tools and agents.

Ondra MedekJul 9, 2026, 07:33 UTC on lore

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

Back to recent threads