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

Re: "man git-tag" inconsistent about whether you can tag non-commit objects

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
May 25, 2018, 07:45 UTC
Message-ID
<87muwo6uwq.fsf@evledraar.gmail.com>
In-Reply-To
<xmqqpo1kpl9i.fsf@gitster-ct.c.googlers.com>
On Fri, May 25 2018, Junio C Hamano wrote:
Show 34 quoted lines
> "Robert P. J. Day" <rpjday@crashcourse.ca> writes:
>
>>   embarrassed to admit i had no idea that you could tag non-commit
>> objects, only realized that when i was reading the man page and saw:
>>
>>   SYNOPSIS
>>      git tag [-a | -s | -u <keyid>] [-f] [-m <msg> | -F <file>] [-e]
>>            <tagname> [<commit> | <object>]
>>                                  ^^^^^^^^
>>
>> so i tried it and, sure enough, i could tag a blob object. but if you
>> read further into DESCRIPTION, about halfway through, you read:
>>
>>   "Otherwise just a tag reference for the SHA-1 object name of the
>>    commit object is created (i.e. a lightweight tag)."
>>    ^^^^^^
>>
>> which suggests only commit objects. finally, much further down, under
>> OPTIONS:
>>
>>   "<commit>, <object>
>>      The object that the new tag will refer to, usually a commit.
>>                                                 ^^^^^^^^^^^^^^^^
>>
>> so to clean this up, is it sufficient to just change that middle line
>> to say "object" rather than "commit object"? or is there more in the
>> man page that needs tweaking?
>
> As that sentence talks about a lightweight tag (i.e. a reference in
> refs/tags/ hierarchy that directly points at an object of any kind),
> another possibility would be to say
>
> 	Otherwise a tag reference that directly points at the given
> 	object (i.e. lightweight tag) is created.

Related, this recent patch of mine: https://public-inbox.org/git/20180429202100.32353-6-avarab@gmail.com/#t

I.e. might be worth talking about this briefly in the git-tag manpage as well, i.e. that you can create a lightweight "tag" to a commit, but then depending on where you push it it becomes either a branch or a tag, which may not be intuitive to users...

Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 5 in “"man git-tag" inconsistent about whether you can tag non-commit objects”
  1. Robert P. J. DayMay 24, 2018
  2. Junio C HamanoMay 25, 2018
  3. Ævar Arnfjörð BjarmasonMay 25, 2018
  4. Junio C HamanoMay 25, 2018
  5. Robert P. J. DayMay 25, 2018

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.