commit、tree、blob三个对象之间的关系

commit、tree、blob三个对象之间的关系

十月 21, 2019

commit、tree、blob三个对象之间的关系

$ git log
commit 4b6999eecb60df46af36c5409e3737e44b877dd7 (HEAD -> master)
Author: xxx <xxx@xxx.com>
Date: Sun May 19 13:50:07 2019 +0800

create folder and file

commit 6d4192be4c570363865468870d14f59efaa5521e
Author: xxx <xxx@xxx.com>
Date: Sun May 19 13:46:22 2019 +0800

create abc

commit 4d2bdddf4098e40ce57fdaf04bb862f7bea04918
Author: xxx <xxx@xxx.com>
Date: Mon Apr 29 21:36:15 2019 +0800

rename

commit d34df54beffb33cf6e4f4e97d0f0e24f2b676d51 (tag: test)
Author: xxx <xxx@xxx.com>
Date: Mon Apr 29 21:02:02 2019 +0800

学习工作区和暂存区

commit 33f7ae4c4d4da85453ed0077670e242b71d0a621
Author: xxx <xxx@xxx.com>
Date: Sun Apr 28 22:19:09 2019 +0800

Add readme
$ git cat-file -p 4b6999ee #查看一下地址为4b6999ee的commit内容 发现里边有一颗树
tree 283144d15658fc8307f3cc01e7c962c3959a0121
parent 6d4192be4c570363865468870d14f59efaa5521e
author xxx <jamme_lee@outlook.com> 1558245007 +0800
committer xxx <jamme_lee@outlook.com> 1558245007 +0800

create folder and file
$ git cat-file -p 283144d #查看tree的内容 下边存了a、abc、readme.md文件和folder文件夹
100644 blob 64fa4ac5cffbaa8c5b03f26eec62ae6244f2b435 a
100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 abc
040000 tree c32d14e3847d3a6e6f31261adfb0cb0b334beec5 folder
100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 readme.md
$ git cat-file -p c32d14e #再查看folder文件夹的tree 发现内容就是files文件的blob对象
100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 files