Git 进阶之底层相关

Git is a content-addressable filesystem.

1. Plumbing 和 Porcelain

  • "Plumbing commands": Git 底层的操作;
  • "Porcelain commands": Git 封装的操作,例如 checkout,branch,remote等;

2. Git 文件结构

  • git init: 在当前文件夹,创建.git目录;
  • "config": 当前项目的配置选项;
  • "info": 配置着在.gitignore中排除的文件内容;
  • "hooks": 包含客户端和服务端的hook;
  • 最重要的四个实体:
    • "objects": 存储着Git仓库的所有内容;
    • "refs": 指向已提交内容的指针(branches,tags,remotes and more);
    • "HEAD": 当前指向的分支;
    • "index"(待创建): 存储staging区域中的内容;

2.1 Objects

  • Tree Objects: 树类似于UNIX系统中的目录,Blob类似于文件;
  • Blob 文件的类型:
    • "100644": 表示正常的文件;
    • "100755": 表示为可执行文件;
    • "120000": 符号链接(symbolic link);

参考资料:

原文地址:https://www.cnblogs.com/linkworld/p/9462229.html