Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the common usages of tagging something else than a commit?

Tags:

git

tagging

Git-tag documentation states that a tag should target a commit. So does the git book.

However, the tests show that one tag can as well target a tree, a blob or even another tag.

Have you ever leveraged this feature? Are there some development workflows that benefit from being able to directly tag something else than a commit? Do you know any tools that rely on this git ability?

EDIT:

I've just found an old post on 365Git by @abizern which raises the same question:

You can create tag objects for more than just commits, you can tag blobs and trees as well, just by passing in the sha of the blob or the tree. Why anyone would want to do this is beyond me. It isn’t as if you can check out a single file based on a tagged blob, although you could reference it’s contents. Maybe it can be used to cryptographically sign a file or a tree as coming from a particular source so verify it’s integrity.

like image 525
nulltoken Avatar asked Nov 05 '22 22:11

nulltoken


1 Answers

From a general point of view, sometime, your developpers have more than one feature in a commit : if you want to pull one without pulling the other in your tag, you can't tag on a commit, but you have to do somehow what CVS is doing : tagging each file. Can be pretty useful when prototyping

like image 51
Bruce Avatar answered Nov 15 '22 03:11

Bruce