如何在不使用 git 的情况下查看 git 对象和索引 [英] How to view git objects and index without using git

查看:23
本文介绍了如何在不使用 git 的情况下查看 git 对象和索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 OS X 终端,

Using the OS X terminal,

您如何以纯文本形式查看这些文件的内容?

How an you view the contents of these files as plain text?

推荐答案

Git 用户手册中的对象存储格式".

它是使用 zlib 的原始压缩数据.可以使用zlib1g-dev"包中的 zpipe.使用 gcc -o zpipe zpipe 编译示例.c -lz.它不是标准的 .gz 或其他东西.

It is raw compressed data using zlib. One can use zpipe from the 'zlib1g-dev' package. Compile the example with gcc -o zpipe zpipe.c -lz. It is not a standard .gz or something.

./zpipe -d < .git/objects/02/43019ddb4d94114e5a8580eec01baeea195133

打印 blob 的内容(标题+数据)

prints the content of the blob (header+data)

如果你想检查 SHA-1,你必须把未压缩的 blob 放在一个文件中 (myblob) 然后做

If you want to check the SHA-1, you have to put the uncompressed blob in a file (myblob) and do

sha1sum myblob

这篇关于如何在不使用 git 的情况下查看 git 对象和索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆