home | list info | list archive | date index | thread index

Re: [OCLUG-Tech] "git fetch" versus "git fetch --tags"?

A normal "git fetch" will fetch tags that point to commits being fetched.
So if you are fetching new histroy that has a tag pointing to it, that tag
will be fetched with it.  But by default, fetch only pulls "refs/heads/*"
(branch namespace).  Adding a "--tags" will make it fetch "refs/tags/*" too.

This matters if tags are pushed to the remote that point to "historic"
commits (ones you already have in your local repo).

On Sun, Jun 28, 2015 at 6:53 AM, Robert P. J. Day <rpjday [ at ] crashcourse [ dot ] ca>
wrote:

>
>   once again, into the pedantry of a git command. for an upcoming
> course, i'm writing a tutorial on how to start working with a remote,
> and i'm using the example of adding linux-next as a remote to the
> stock kernel, as explained here:
>
>   https://www.kernel.org/doc/man-pages/linux-next.html
>
> but i was puzzled with the following snippet of directions:
>
>    Fetch linux-next plus tags
>
>       $ git fetch linux-next
>       ...
>       $ git fetch --tags linux-next
>       ...
>
> is it really necessary to run two separate commands, to:
>
>  * first fetch the content
>  * then fetch the tags?
>
> i would have thought that running that second command would be
> sufficient, since the git-fetch man page reads thusly:
>
>  -t, --tags
>    Fetch all tags from the remote (i.e., fetch remote tags refs/tags/*
>    into local tags with the same name), in addition to whatever else
>    would otherwise be fetched.
>
> note, "in addition to whatever else would otherwise be fetched." so
> isn't that suggesting that that command would do the normal fetch of
> content, *and* get the tags as well? or am i misreading something?
>
> rday
>
> --
>
> ========================================================================
> Robert P. J. Day                                 Ottawa, Ontario, CANADA
>                         http://crashcourse.ca
>
> Twitter:                                       http://twitter.com/rpjday
> LinkedIn:                               http://ca.linkedin.com/in/rpjday
> ========================================================================
> _______________________________________________
> Linux mailing list
> Linux [ at ] lists [ dot ] oclug [ dot ] on [ dot ] ca
> http://oclug.on.ca/mailman/listinfo/linux
>
>