Re: Tags auto fetched by "git fetch origin" but not "git fetch origin main"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux