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
Junio C Hamano <gitster@pobox.com>
Date
May 25, 2018, 08:47 UTC
Message-ID
<xmqqh8mwnmus.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<87muwo6uwq.fsf@evledraar.gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 14 quoted lines
>> 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...

I am not sure if I agree. People won't get confused, unless they think too much and pedantically.

If you make refs/tags/$name point at a commit, it becomes a lightweight tag, if you make refs/heads/$name point at a commit, it becomes a local branch, if you make refs/remotes/$remote/$name point at a commit, it behaves as a remote-tracking branch for the named $remote. Anywhere else, it is just a random ref that happens to point at a commit.

And notice that I never said "push" in the above. The verb I used is "make" and that is deliberate. It does not make any difference if you make such a ref point at a commit by pushing into a repository, fetching from elsewhere, or running "git branch", "git tag", "git update-ref" locally.

Previous: Ævar Arnfjörð BjarmasonNext: Robert P. J. Day
Message 4 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.