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

Re: [PATCH v2] git-tag: Allow --points-at syntax to create a tag pointing to specified commit

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 14, 2013, 15:48 UTC
Message-ID
<7v38vyyoc6.fsf@alter.siamese.dyndns.org>
In-Reply-To
<5141E056.3090808@redhat.com>
Michal Novotny <minovotn@redhat.com> writes:
> Oh, interesting. It's working now and I didn't know that as it was not
> working some time ago I've been trying this approach. Maybe it's been
> added recently...

Pretty much from the very beginning "git tag <name> <commit>" has been the way to create a tag, with missing <commit> defaulting to HEAD. In retrospect, it _might_ have been a more consistent UI organization if the object to point the new tag at were given with a command line argument like --point-at=<object>, absence of which defaults to HEAD, but it is a bit too late for that.

By the way, your implementation is wrong and it shows that you are not aware that a tag, either annotated or lightweight, can point at any object, not just a commit.

> ... as I also saw several sites having different approach of
> tagging to specified commit (usually creating a new branch, tagging
> there and rebasing etc.).

There are at least two explanations that are more plausible than that.

When rebasing an existing branch, especially if you are not familiar with Git and want to be extra cautious, it is not unreasonable to practice it by running the rebase on a new branch that you are willing to discard when something goes in an unexpected way. If the tip of that throw-away branch happens to be where you want to tag, it is easier to do

	git checkout -b new-branch <<some long object name>>
        git tag return-here
than
	git checkout -b new-branch <<some long object name>>
        git tag return-here <<the same long object name again>>

So it is understandable that "if untold, default to HEAD" is used in such a workflow. After all, we made it to default to HEAD exactly because that is one of the most common thing to do.

Another plausible explanation is that these "sites" are written by people who do not know what they are writing, which is not a big news in the Internet.

It would surely be nice to get these "sites" fixed.
Previous: Michal Novotny
Message 4 of 4 in “git-tag: Allow --points-at syntax to create a tag pointing to specified commit”
  1. git-tag: Allow --points-at syntax to create a tag pointing to specified commitMichal Novotny, Mar 14, 2013
  2. John KeepingMar 14, 2013
  3. Michal NovotnyMar 14, 2013
  4. Junio C HamanoMar 14, 2013

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.