简体   繁体   English

git cat-file标签TAG返回:“致命:git cat-file TAG:错误的文件”

[英]git cat-file tag TAG return: “fatal: git cat-file TAG: bad file”

I have the following tree: 我有以下树:

O---O---O---O <- master
 \--O---O <- work branch
        /\
        ||
        TAG

When I run git cat-file I get an error: 当我运行git cat-file时,出现错误:

> git cat-file tag TAG
fatal: git cat-file TAG: bad file

Do anyone has an idea what is wrong here? 有人知道这里有什么问题吗?

What do you expect to happen? 您期望发生什么? Perhaps you want: 也许您想要:

git cat-file commit TAG

... which prints some information about the commit that TAG points to. ...显示有关TAG指向的提交的一些信息。 (ie the <type> that git cat-file is expecting should be commit rather than tag .) (即git cat-file期望的<type>应该被commit而不是tag 。)

Update: as I mentioned in a comment below, if what you want is the object name (the hash) of the commit, you can get that with: 更新:正如我在下面的评论中提到的那样,如果您想要的是提交的对象名称(哈希),则可以通过以下方式获得:

git rev-parse --verify TAG

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

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