Re: unclear documentation of git fetch --tags option and tagopt config

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

 



乙酸鋰 <ch3cooli@xxxxxxxxx> writes:

> With git fetch --tags
> or remote.origin.tagopt = --tags
> git fetch only fetches tags, but not branches.
> Current documentation does not mention that no branches are fetched /
> pulled when --tags option or remote.origin.tagopt = --tags is
> specified.

In the canonical form you spell out what you want to fetch from
where, and a lazy "git fetch" or "git fetch origin" that does not
specify what are to be fetched are the special cases.  Because they
do not say what to fetch, they would become a no-op, which would not
be very useful, if there is no special casing for them.  Instead,
they use sensible default, taking refspec from the configuration
variable remote.$name.fetch.

Giving refspecs or the "--tags" option from the command line is a
way to explicitly override this default, hence:

    $ git fetch origin HEAD

only fetches the history leading to the commit at HEAD at the
remote, ignoring the configured refspecs.  As "--tags" is a synonym
to "refs/tags/*:refs/tags/*", "git fetch --tags origin" tells us to
ignore refspecs and grab only the tags, i.e.:

    $ git fetch origin "refs/tags/*:refs/tags/*"

which does not grab any branches.

You can of course do:

    $ git fetch --tags origin refs/heads/master:refs/remotes/origin/master

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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]