git cat文件失败,没有其他信息
虽然这是直接从专业的git书籍,第226页,它不适合我。我只返回命令帮助文本,没有其他错误或文本:git cat文件失败,没有其他信息,git,Git,虽然这是直接从专业的git书籍,第226页,它不适合我。我只返回命令帮助文本,没有其他错误或文本: git cat-file -p master^{tree} D:\Users\jon\Documents\GitHub\FilePathContextMenu[master]>git cat文件-p mast er^{tree} 用法:git cat文件(-t |-s |-e |-p |--textconv) 或:git cat文件(-batch |--batch check)< 可以是以下选项
git cat-file -p master^{tree}
D:\Users\jon\Documents\GitHub\FilePathContextMenu[master]>git cat文件-p mast
er^{tree}
用法:git cat文件(-t |-s |-e |-p |--textconv)
或:git cat文件(-batch |--batch check)<
可以是以下选项之一:blob、tree、commit、tag
-不显示对象类型
-s显示对象大小
-e在没有错误时以零退出
-p打印对象的内容
--textconv对于blob对象,在对象的内容上运行textconv
--批处理[=]显示从标准输入的对象的信息和内容
输入
--批量检查[=]
显示有关从标准输入馈送的对象的信息
请注意,如果您在a中使用该行(使用Git For Windows,因为您似乎在Windows上,根据判断),您将获得:
D:\Users\jon\Documents\GitHub\FilePathContextMenu [master]> git cat-file -p mast
er^{tree}
usage: git cat-file (-t|-s|-e|-p|<type>|--textconv) <object>
or: git cat-file (--batch|--batch-check) < <list_of_objects>
<type> can be one of: blob, tree, commit, tag
-t show object type
-s show object size
-e exit with zero when there's no error
-p pretty-print object's content
--textconv for blob objects, run textconv on object's content
--batch[=<format>] show info and content of objects fed from the standard
input
--batch-check[=<format>]
show info about objects fed from the standard input
您需要转义^
,它在cmdshell中是“^
”:
fatal: Not a valid object name master{tree}
注意:
git cat文件-p master^{TREE}
不起作用:TREE必须是小写的。对我来说很好(版本1.9.1)。您使用的是哪个版本的Git?还确认可以在我的1.7.11.3设置中使用@Jon你能公布你得到的确切错误吗?@MakotoGit版本1.8.4.msysgit。0@Mureinik向post添加了输出。这是一个很好的猜测,但根据问题OP没有错误,没有“致命:不是有效的对象名master{tree}”消息。@VonC是windows 7;使用gitshell(与GitHub一起安装)。hvd是正确的,没有其他消息。@Jon您执行该命令时是否处于空git repo中?还是一个还没有提交的repo?@VonC repo不是空的,它有几个提交。@Jon那么git cat文件应该可以像广告中那样工作。你能给我们看一下你正在键入的命令的屏幕截图吗?
C:\Users\vonc\prog\git\git>git cat-file -p master^^{tree}
100644 blob 5e98806c6cc246acef5f539ae191710a0c06ad3f .gitattributes
100644 blob dc600f9b36d09f0668064e044520c7ce633f09d8 .gitignore
100644 blob 11057cbcdf4c9f814189bdbf0a17980825da194c .mailmap
100644 blob 536e55524db72bd2acf175208aef4f3dfc148d42 COPYING
040000 tree 81319ed97d893e6e4afd37697ceac6be04e1a02b Documentation
100755 blob 2b97352dd3b113b46bbd53248315ab91f0a9356b GIT-VERSION-GEN