Git 有两种命令,一种是叫做 *porcelain*,这种是 high-level 的命令,即日常用到的 `git add`, `git commit`, `git status`, `git log`, `git reset`, `git checkout`等等 。还有一种就是 *plumbing*,这种是 low-level 的命令,它让我们可以真正触碰到 git 内部的数据结构。其实这里很好理解,*porcelain*英文意思是瓷器,瓷器就是表面光鲜的意思,当然是指大家常见的命令了。*plumbing*英文意思是管道,管道自然在内部,代指不常见命令了。但二者其实都可以在命令行中直接使用。 一般我们都不会用到 *plumbing* 命令,除非去研究 Git 的源码。但是手动去操作一个仓库,将加深对 Git 实际存储数据的原理的理解,进而对 *porcelain* 命令有更深刻的理解。 接下来我们通过一个例子开始研究 Git 的 *object database(对象数据库 )*。然后我们将使用 *plumbing* 命令手动创建和提交一个快照。 ``` ➜ temp git:(main) ✗ ll total 96 drwxr-xr-x 5 administrator staff 160B Sep 20 16:14 about -rw-r--r-- 1 administrator staff 312B Sep 20 16:14 blue.html -rw-r--r-- 1 administrator staff 351B Sep 20 16:14 green.html -rw-r--r-- 1 administrator staff 1.2K Sep 20 16:14 index.html -rw-r--r-- 1 administrator staff 416B Sep 20 16:14 news-1.html -rw-r--r-- 1 administrator staff 502B Sep 20 16:14 news-2.html -rw-r--r-- 1 administrator staff 548B Sep 20 16:14 news-3.html -rw-r--r-- 1 administrator staff 372B Sep 20 16:14 orange.html -rw-r--r-- 1 administrator staff 462B Sep 20 16:14 pink.html -rw-r--r-- 1 administrator staff 593B Sep 20 16:14 rainbow.html -rw-r--r-- 1 administrator staff 347B Sep 20 16:14 red.html -rw-r--r-- 1 administrator staff 315B Sep 20 16:14 style.css -rw-r--r-- 1 administrator staff 356B Sep 20 16:14 yellow.html ``` ## demo下载 链接:https://pan.baidu.com/s/1RSg-KSXvnvKD0VLBEf3NLg 密码:sgru