简体   繁体   中英

git cat-file lists parents of tag as tree

$ git cat-file -p v0.87.1

tree e2c1430c2a24b5878c4928d576f4c92f51047709 parent f70a7297f624629e34882b800c75bc4af0193d85
author Abc Abc 1438782699 -0700
committer Abc Abc 1438782699 -0700

v0.87.1

Can you help me understand this output? The tree listed is not in git log, but the parent is.

Specifically what would have been the git tag command that created this 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.

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). 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. 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.

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. Alternatively, -m or --message followed by a 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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