threads / discuss / 9499

syntax for checking out specific tag on a remote

Subject: syntax for checking out specific tag on a remote

## tl;dr

5 messages between Aug 12, 2007 and Aug 12, 2007.

replies: 4people: 2as markdown or json

Jon Smirl· Aug 12, 2007, 01:33 UTC · lore
What's the syntax for checking out a specific tag on a remote?

I tried: git checkout -b my19 linus/master/v2.6.19 git checkout linus/master/v2.6.19 git checkout linus/v2.6.19

jonsmirl@terra:/home/linux$ git remote show linus
* remote linus
  URL: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
-- 
Jon Smirl
jonsmirl@gmail.com
Junio C Hamano· Aug 12, 2007, 01:41 UTC · re: Jon Smirl · lore

Re: syntax for checking out specific tag on a remote

"Jon Smirl" <jonsmirl@gmail.com> writes:
> What's the syntax for checking out a specific tag on a remote?

This depends on where you stored the tags you obtained from the remote. By default, "git fetch --tags" would store the tags in a flat namespace; there is no "remote tag" namespace.

Hence you would say:
	git checkout v2.6.19

to get a detached HEAD at v2.6.19, or if you want to start a branch from there,

	git checkout -b my19 v2.6.19
Jon Smirl· Aug 12, 2007, 01:50 UTC · re: Junio C Hamano · lore

Re: syntax for checking out specific tag on a remote

On 8/11/07, Junio C Hamano <gitster@pobox.com> wrote:
Show 7 quoted lines
> "Jon Smirl" <jonsmirl@gmail.com> writes:
>
> > What's the syntax for checking out a specific tag on a remote?
>
> This depends on where you stored the tags you obtained from the
> remote.  By default, "git fetch --tags" would store the tags in
> a flat namespace; there is no "remote tag" namespace.

I've been storing unrelated trees in the same git db. It never occurred to me that there was a single tag name space. So if two of my remotes both make a tag TEST then last one fetched will win? Are "remote tag" namespaces planned for the future?

Show 11 quoted lines
>
> Hence you would say:
>
>         git checkout v2.6.19
>
> to get a detached HEAD at v2.6.19, or if you want to start a
> branch from there,
>
>         git checkout -b my19 v2.6.19
>
>
-- 
Jon Smirl
jonsmirl@gmail.com
Jon Smirl· Aug 12, 2007, 01:57 UTC · re: Jon Smirl · lore

Re: syntax for checking out specific tag on a remote

On 8/11/07, Jon Smirl <jonsmirl@gmail.com> wrote:
Show 13 quoted lines
> On 8/11/07, Junio C Hamano <gitster@pobox.com> wrote:
> > "Jon Smirl" <jonsmirl@gmail.com> writes:
> >
> > > What's the syntax for checking out a specific tag on a remote?
> >
> > This depends on where you stored the tags you obtained from the
> > remote.  By default, "git fetch --tags" would store the tags in
> > a flat namespace; there is no "remote tag" namespace.
>
> I've been storing unrelated trees in the same git db. It never
> occurred to me that there was a single tag name space. So if two of my
> remotes both make a tag TEST then last one fetched will win? Are
> "remote tag" namespaces planned for the future?

This seems inconsistent to me. Remote heads have their own namespace but remote tags don't.

-- 
Jon Smirl
jonsmirl@gmail.com
Junio C Hamano· Aug 12, 2007, 02:01 UTC · re: Jon Smirl · lore

Re: syntax for checking out specific tag on a remote

"Jon Smirl" <jonsmirl@gmail.com> writes:
Show 13 quoted lines
> On 8/11/07, Junio C Hamano <gitster@pobox.com> wrote:
>> "Jon Smirl" <jonsmirl@gmail.com> writes:
>>
>> > What's the syntax for checking out a specific tag on a remote?
>>
>> This depends on where you stored the tags you obtained from the
>> remote.  By default, "git fetch --tags" would store the tags in
>> a flat namespace; there is no "remote tag" namespace.
>
> I've been storing unrelated trees in the same git db. It never
> occurred to me that there was a single tag name space. So if two of my
> remotes both make a tag TEST then last one fetched will win? Are
> "remote tag" namespaces planned for the future?
There actually is no need to plan anything.

Typically people do not publish "private" tags to require such a layout to differentiate tags from 47 different sources, so we have never talked about this, but you can look into .git/config file in your repository, and adjust [remote "foo"] fetch lines to your specific taste. e.g.

	[remote "a"]
        	fetch = +refs/heads/*:refs/remotes/a/*
                fetch = +refs/tags/*:refs/remote-tags/a/*
	[remote "b"]
        	fetch = +refs/heads/*:refs/remotes/b/*
                fetch = +refs/tags/*:refs/remote-tags/b/*

← back to recent threads