Web lists-archives.com

Unify annotated and non-annotated tags


It is hard to work with Git tags, because on low level hash
of non-annotated tag is pointing to commit, but hash for
annotated tag is pointing to tag metadata.

On low level that means that there is no way to get commit
hash from tag in a single step. If tag is annotated, you need
to find and parse ^{} string of show-ref, if not, then look for
string without ^{}.

So, why not just make all tags work the same so that every
tag has its own hash and you need to dereference it in the
same way to get commit hash?

This way I could get all commit hashes with just:

    git show-ref --tags -d | grep "\^{}"

or abandon ^{} completely and show commit hashes on -d:

    git show-ref --tags --dereference

anatoly t.