From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Yukai Chou <muzimuzhi@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Tags auto fetched by "git fetch origin" but not "git fetch origin main"
Date: Thu, 29 Aug 2024 21:32:43 +0000 [thread overview]
Message-ID: <ZtDo--AY43-bPTHG@tapette.crustytoothpaste.net> (raw)
In-Reply-To: <CAEg0tHRbGBBq7i78bTSfws_WZO=2W7xuDwiT2qFA5iOza8qDDA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 994 bytes --]
On 2024-08-28 at 23:23:57, Yukai Chou wrote:
> In using `git fetch [<options>] [<repository> [<refspec>…]]`,
> - when a branch is specified as <refspec>, no tags are fetched automatically;
> - when no <refspec>s are specified, tags are fetched automatically.
Yes, this is expected. Tags are refs, and when you specify no refspec,
you're asking for the default behaviour, which usually involves fetching
tags. But when you specify a refspec, you are saying, "I want you to
fetch this, and only this; don't fetch anything else."
For example, if I say, `git fetch origin
refs/heads/main:refs/heads/main`, it would be very unexpected for it to
fetch tags as well; I only wanted it to fetch the main branch. In fact,
I might be explicitly relying on it not affecting any other refs.
If you want tags nonetheless, you can use the `--tags` option, which
should fetch tags in addition to the refspec provided.
--
brian m. carlson (they/them or he/him)
Toronto, Ontario, CA
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
next prev parent reply other threads:[~2024-08-29 21:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-28 23:23 Tags auto fetched by "git fetch origin" but not "git fetch origin main" Yukai Chou
2024-08-29 21:32 ` brian m. carlson [this message]
2024-08-29 21:44 ` Junio C Hamano
2024-08-29 22:22 ` brian m. carlson
2024-08-29 22:38 ` Junio C Hamano
2024-08-29 23:16 ` Yukai Chou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZtDo--AY43-bPTHG@tapette.crustytoothpaste.net \
--to=sandals@crustytoothpaste.net \
--cc=git@vger.kernel.org \
--cc=muzimuzhi@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox