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

Re: determine name of tag used for checkout when multiple tags exist?

From
Jacob Keller <jacob.keller@gmail.com>
Date
Sep 4, 2015, 04:59 UTC
Message-ID
<CA+P7+xo8BM1hCnkh3pa65eF=qne3yybTBCoBY3mqm8FfzwdShg@mail.gmail.com>
In-Reply-To
<CAL3By-8odLE53iBiNATgiCcnK4Ef5uBeH7E6EMB1K7P-oX0oAQ@mail.gmail.com>
On Thu, Sep 3, 2015 at 7:53 PM, Jesse Hopkins <jesse.hops@gmail.com> wrote:
Show 7 quoted lines
>
> It seems to me that when checking out to a tag, Git does not record the
> *name* of the tag anywhere, but rather sets HEAD to the de-referenced
> commit SHA-1.  As far as I can tell, it is not possible to recover the
> original name of the tag in the case of multiple tags on the same commit.
> Is my conclusion correct?
>

I believe you are correct unless you check out to a branch named after the tag? I don't believe it will actually store the tag as part of its checkout.

Ie:
git checkout <tag>

may show "checked out at <tag>" via status, but that is only because status uses describe to find that out..

I don't believe we store the information. You could recover it if you know something about the format so as to distinquish them, ie: if you only cared about annotated tags vs lightweight tags, for example.

Regards, Jake

Previous: Jesse HopkinsNext: John Keeping
Message 2 of 5 in “determine name of tag used for checkout when multiple tags exist?”
  1. Jesse HopkinsSep 4, 2015
  2. Jacob KellerSep 4, 2015
  3. John KeepingSep 4, 2015
  4. John KeepingSep 4, 2015
  5. Jesse HopkinsSep 5, 2015

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.