On Thu, Mar 21, 2019 at 2:29 PM Jeff King <peff@xxxxxxxx> wrote: > Tags can point to any object, including another tag. It looks like > somebody made an annotated tag of an annotated tag (probably by > mistake, given that they have the same tag-name). > > Try this: > > git init > git commit -m commit --allow-empty > git tag -m inner mytag HEAD > git tag -f -m outer mytag mytag > > git show mytag > > which produces similar output. You can walk the chain yourself with "git > at-file tag 4.2.0.1900". That will have a "type" and "object" field > which presumably point to the second commit. > > My guess is that somebody was trying to amend the tag commit message, > but used the tag name to create the second one, rather than the original > commit. I.e,. any of these would have worked for the second command to > replace the old tag: > > git tag -f -m 'new message' mytag HEAD > > git tag -f -m 'new message' 2fcfd00ef84572fb88852be55315914f37e91e11 > > git tag -f -m 'new message' mytag mytag^{commit} > > If the original tag isn't signed, you could rewrite it at this point > using one of the above commands, coupled with GIT_COMMITTER_* to munge > the author and date. But note that fetch doesn't update modified tags > by default, so it may just cause confusion if you have a lot of people > using the repository. Thanks for explaining. This is very helpful. Am I naive to think that this should be an error? I haven't seen a valid _pragmatic_ use for tags pointing to tags. In 100% of cases (including this one), it is done out of error. As per your example, users try to "correct" an annotated tag pointing at a wrong tag or commit. What they expect is the tag to point to the other tag's commit, but that's not what they get. >From a high-level, pragmatic perspective, doesn't it make more sense to change the git behavior so that annotated tags may only point to commit objects? And in the `git tag -f -m outer mytag mytag` case in your example, this would automatically perform `mytag^{}` to ensure that the behavior the user expects is the behavior they get?