git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: feature "git tag -r" to show tags and commits they are pointing to

From
ESEugene Sajine <euguess@gmail.com>
Date
Oct 23, 2009, 14:48 UTC
Message-ID
<76c5b8580910230748n620ad3a8o58811732be7c369f@mail.gmail.com>
In-Reply-To
<7v8wf2ejna.fsf@alter.siamese.dyndns.org>
Show 36 quoted lines
> You do not have to live with a tag that points at another tag that points
> at a commit.
>
> You can still tag the commit directly with your new tag, and you do not
> need to have the exact commit object name to do so.  You just tell the
> tool to follow the tag chain to get to the pointed-to object, like this:
>
>    $ git tag -a -m "my message" newtag oldtag^0
>
> This assumes [*1*] that the old tag points at (strictly speaking, "might
> point at") a commit object, and uses "^0" (zeroth parent of) operator to
> make sure that the object the newtag points at (the last argument to the
> "git tag" command, i.e. "oldtag^0" in this example) is a commit object,
> not an annotated tag "oldtag" itself.
>
> That is what I meant by "just as usable as hexadecimal to the tools".
>
>>> ... "v0.1" is
>>> much more useful than 8794hke to humans, and these tag names are just as
>>> usable as the hexadecimal commit object names to the tools.  You can say
>>> "git show v0.1^0" and "git show 8794hke" and get the same thing.
>
> [Footnote]
>
> *1* A tag can point at any object, not necessarily a commit.  If oldtag
> points at a tree object (or a blob object), oldtag^0 will fail, because
> the operator "^0" is "zeroth parent of", and is applicable only to a
> commit.  In general, you can write
>
>    $ git tag -a -m "my message" newtag oldtag^{}
>
> The "^{}" operator is a special case of "^{type}" operator; the former
> means "dereference the tag repeatedly until it becomes something that is
> not a tag", and the latter means "dereference the tag repeatedly until it
> becomes something of that type".  I.e. "oldtag^0" is "oldtag^{commit}".
>
Junio,
Thank you very much for such detailed explanation! I do appreciate it.
Eugene
Previous: Junio C Hamano
Message 5 of 5 in “feature "git tag -r" to show tags and commits they are pointing to”
  1. Eugene SajineOct 22, 2009
  2. Junio C HamanoOct 22, 2009
  3. Eugene SajineOct 23, 2009
  4. Junio C HamanoOct 23, 2009
  5. Eugene SajineOct 23, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.