YoavKlein
YoavKlein

Reputation: 2715

What is tagging an object which isn't a commit in Git?

The git tag documentation says that you can tag either a commit or an object:

<commit>
<object>
The object that the new tag will refer to, usually a commit. Defaults to HEAD.

And indeed you can take the hash of a blob object and tag it. But I don't understand - what is it good for? what can you do with this tag?

Upvotes: 4

Views: 443

Answers (1)

phd
phd

Reputation: 95028

You can tag anything to give thing a name instead of a long cryptic ID and to prevent garbage collector to remove unreferenced objects.

For example, I store my GPG public key (to verify my signed commits/tags) as a blob and tag the blob (the technics is described in Git Book, chapter Git Internals - Git References).

Upvotes: 8

Related Questions