除了提交之外,标记其他内容的常见用法是什么?
Git-tag 文档指出标签应该以提交为目标。 git 书籍也是如此。
然而,测试表明一个标签也可以定位一棵树、一个斑点甚至另一个标签。
您曾经利用过这个功能吗?是否有一些开发工作流程受益于能够直接标记除提交之外的其他内容?你知道有哪些依赖 git 功能的工具吗?
编辑:
我刚刚在 365Git by @abiizern 提出了同样的问题:
您可以创建更多标签对象 不仅仅是提交,您还可以标记 blob 还有树木,只要路过 斑点或树的煞。为什么 任何人都想做这件事,这超出了 我。这并不是说你可以查看 基于标记 blob 的单个文件, 虽然你可以参考它 内容。也许它可以用来 对文件或文件进行加密签名 树来自于特定的 来源,因此请验证其完整性。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从一般角度来看,有时,您的开发人员在提交中拥有多个功能:如果您想拉取一个功能而不在标记中拉取另一个功能,则无法在提交上标记,但您必须以某种方式执行以下操作CVS 正在做:标记每个文件。原型设计时非常有用
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