git 的 cat-file 命令用法

命令选项

git cat-file Provide content or type and size information for repository objects.

git cat-file 命令显示版本库对象的内容、类型及大小信息。

object

The name of the object to show. For a more complete list of ways to spell object names, see the “SPECIFYING REVISIONS” section in gitrevisions(7).

-t
Instead of the content, show the object type identified by object.
显示对象的类型。

-s
Instead of the content, show the object size identified by object.
显示对象的大小。

-e
Suppress all output; instead exit with zero status if object exists and is a valid object.
如果对象存在且有效,命令结束状态返回值为 0 。

-p

Pretty-print the contents of object based on its type.
根据对象的类型,以优雅的方式显式对象内容。

type
Typically this matches the real type of object but asking for a type that can trivially be dereferenced from the given object is also permitted. An example is to ask for a “tree” with object being a commit object that contains it, or to ask for a “blob” with object being a tag object that points at it.

用法示例

sha1sum 命令生成字符串 “Git” 的哈稀值:

printf Git | sha1sum

生成 HEAD 对象的哈稀值:

(printf "%s %d\000" `git cat-file -t HEAD` `git cat-file -s HEAD`; git cat-file -p HEAD) | sha1sum

参考

git-cat-file
gitrevisions

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值