现在让我们使用一些工具来直接探究 Git 对象。

    这应当显示仓库中所做的最新提交。在你的系统中的 SHA1 哈希也许与我的不同,但应该看起来类似。

    1. * 96ee164 2013-04-13 | Added a Rakefile. (HEAD, master) [Jim Weirich]

    转存最新的提交

    1. $ git cat-file -t <hash>
    2. $ git cat-file -p <hash>

    这儿是我的输出:

    注意:如果你在别名实验中定义了 type 和 别名,那么 你可以输入 git typegit dump,而不是更长的 cat-file 命令(我从未记住过)。

    这是 master 分支头提交对象的转存结果。它看起来很像先前介 绍的提交对象。

    这儿是我的目录树看起来的样子……

    1. 100644 blob 28e0e9d6ea7e25f35ec64a43f569b550e8386f90 Rakefile
    2. 040000 tree e46f374f5b36c6f02fb3e9e922b79044f754d795 lib

    是的,我看到了 Rakefile 和 lib 目录。

    转存 lib 目录

    1. $ git cat-file -p e46f374

    这是 hello.rb 文件。

    1. $ git cat-file -p <rbhash>

    浏览你自己的 Git 仓库

    手动浏览你自己的 Git 仓库。看看是否能通过遵循最新提交的 SHA1 哈希引用来从第一个提交找出最初的 hello.rb 文件。