3. git对象--"git cat-file"

作者:jicanmeng

时间:2015年03月10日


git中共有四种类型的对象:commit对象,tree对象,blob对象,tag对象。

分支总是会指向一个commit对象,一个commit对象中包含一个指向git根目录的tree对象的指针,还包含author和提交信息,还包括parent commit的commit ID。<<Pro Git>>中是这样描述的:

When you commit in Git, Git stores a commit object that contains a pointer to the snapshot of the content you staged, the author and message metadata, and zero or more pointers to the commit or commits that were the direct parents of this commit: zero parents for the first commit, one parent for a normal commit, and multiple parents for a commit that results from a merge of two or more branches.

我们使用git cat-file命令来查看对象的类型的和内容。

参考资料

  1. Pro Git 3 Git Branching
  2. git权威指南 第6章 Git对象