Reputation: 1385
I understand how it is possible to tag a blob, or a tree, or even another annotated tag, using a git tag. I understand the architecture and conceptual design that makes this possible.
However, I'm having trouble thinking of real life applications of this (or "real workflow" applications).
Searching here on Stack Overflow I only found one answer that mentions tagging non-commit objects, with advice not to do so.
Under what possible circumstances could it ever be appropriate to tag a non-commit object?
Upvotes: 7
Views: 2111
Reputation: 141986
Are there any use cases where it would be appropriate to tag a non-commit object?
As you figured out. In a nutshell you should avoid non-commit
tagging.
Lets say for example that you have fixed a code (hot fix) and its part of a bigger commit
Why?
since it was committed like this and only later you figured out that you need only a single file.
Now you want to mark the file (content) of this change without marking all the other content.
Sample 2:
You are going over the code trying to figure out which file caused a bug, to mark a single commit you can use a tag or a git note
but to mark a single file you will use tag
.
And there can some other examples as well.
The Linux kernel repository also has a non-commit-pointing tag object – the first tag created points to the initial tree of the import of the source code
Upvotes: 0
Reputation:
Tagging trees or blobs may be appropriate temporarily in long-running utility programs that manipulate objects directly. Tagging would ensure that git gc
can be safely run in parallel. The utility program would then remove the tags when it's done, when it's created a commit.
Upvotes: 6