简体   繁体   English

git cat-file将标签的父级列出为树

[英]git cat-file lists parents of tag as tree

$ git cat-file -p v0.87.1

tree e2c1430c2a24b5878c4928d576f4c92f51047709 parent f70a7297f624629e34882b800c75bc4af0193d85 树e2c1430c2a24b5878c4928d576f4c92f51047709父级f70a7297f624629e34882b800c75bc4af0193d85
author Abc Abc 1438782699 -0700 作者Abc Abc 1438782699 -0700
committer Abc Abc 1438782699 -0700 提交人Abc Abc 1438782699 -0700

v0.87.1 v0.87.1

Can you help me understand this output? 你能帮我理解这个输出吗? The tree listed is not in git log, but the parent is. 列出的树不在git日志中,但父树在。

Specifically what would have been the git tag command that created this tag? 具体来说,创建该标签的git tag命令是什么? How was the tag created against a tree ? 标签是如何针对树创建的?

git log will show the content of commits in a range of commits and git cat-file will show the content of a given node in the DAG. git log将显示一系列提交中的提交内容,而git cat-file将显示DAG中给定节点的内容。

In this case you have the content of a commit where tree is a reference to a node with a reference and filename for each file and parent is the previous commit (may be more than one in case of a merge commit). 在这种情况下,您具有提交的内容,其中tree是对节点的引用,每个文件都有引用和文件名,而parent是上一个提交(如果是合并提交,则可以多个)。 You can show the tree reference by git log --pretty="format:% t" , more about custumizing the output can be found at http://git-scm.com/docs/git-log Author is the person who made the changes and committer is the person made the commit. 您可以通过显示的树参考git log --pretty="format:% t" ,更多custumizing输出可以在发现http://git-scm.com/docs/git-log Author是谁做的人更改和committer是进行提交的人。 Most of the time they are the same but in cases where someone sends you a patch by mail that you commit, they will have different values. 在大多数情况下,它们是相同的,但是如果有人通过您提交的邮件向您发送补丁,则它们将具有不同的值。

The tag in question must be a light-weight tag, which is simply a ref. 所涉及的标签必须是轻标签,只是参考。 git cat-file will therefore show you the content of the object that the tag was pointing to, which in this case is a commit. 因此, git cat-file将向您显示标签所指向的对象的内容,在这种情况下为提交。

You are seeing the normal content of a commit, which tracks the tree (snapshot of the directory structure) of the commit, and its parent commit and other metadata. 您将看到提交的正常内容,该内容跟踪该提交的树(目录结构的快照)及其父提交和其他元数据。

If you want to create an annotated tag, which will actually be a ref to an actual tag object, you must specify -a or --annotate. 如果要创建带注释的标记,它实际上是对实际标记对象的引用,则必须指定-a或--annotate。 Alternatively, -m or --message followed by a message. 或者,-m或--message后跟消息。

Also, it is possible, but not common, for either type of tag to be created against non-commit objects as well. 同样,也可能(但不常见)针对非提交对象创建两种类型的标签。 It is just not the case here. 事实并非如此。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM