Subject: Re: Suggestion: error "tag ... already exists" should distinguish between tagging different or same commit:

From: Junio C Hamano <[email-masked]>
Date: Fri, 11 Jul 2025 12:08:22 -0700

<[email-masked]> writes:

> Considering that git tag T O will generally require a git push
> --force and always a git pull --force in order to update tags on
> the upstream and receiving an update to the tag locally, I think
> requiring git tag --force T O when O is different from the current
> tag is a reasonable idea from a consistency standpoint. I do
> support the notion of git tag T O not requiring a --force if O is
> already where the tag is pointing.

Yup, that is essentially the idea behind that patch.

> The only counter case I can really see in this is when -s is used
> to allow the sign to be updated but even then, does --force really
> change anything when only signing (I think not) because O does not
> change.

In "git tag -s T O" (or "-a" for that matter), O may not change, but
the resulting tag object would certainly be different from the
object that is pointed at by the existing tag reference T, due to
tagger identity and the message in the tag being different from the
original.  So even without O changing ...

> If O changes when signing, I think that --force is almost
> essential to avoid messing up the signatures.

... we would require --force and that would be a good thing.