Michal Novotny <minov...@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

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


        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.
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to