Why git tag a blob or a tree (or a tag)?

前端 未结 2 1908
说谎
说谎 2021-01-12 15:36

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

相关标签:
2条回答
  • 2021-01-12 15:53

    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.

    0 讨论(0)
  • 2021-01-12 16:12

    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

    0 讨论(0)
提交回复
热议问题