# 目录结构

# 目录

.git/
├── config
├── description
├── HEAD
├── index
├── hooks
│   ├── applypatch-msg.sample
│   ├── commit-msg.sample
│   ├── fsmonitor-watchman.sample
│   ├── post-update.sample
│   ├── pre-applypatch.sample
│   ├── pre-commit.sample
│   ├── prepare-commit-msg.sample
│   ├── pre-push.sample
│   ├── pre-rebase.sample
│   ├── pre-receive.sample
│   └── update.sample
├── info
│   └── exclude
├── logs
│   ├── refs
│   └── HEAD
├── objects
│   ├── info
│   └── pack
└── refs
    ├── heads
    └── tags

# config

配置文件, 仅用于当前项目,优先级高于 global

[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
	ignorecase = true
	precomposeunicode = true
[remote "origin"]
	url = git@github.com:aaa/xxx.git
	fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
	remote = origin
	merge = refs/heads/master
[user]
  name = aaa
  email = aaa@aaa.com

工作目录指向的版本号

ref: refs/heads/master

# logs

操作日志,可以跟踪一些操作

# objects

内容仓库,类型分为 committreeblobtag, 目录和文件名加起来就是对象的完整名称,可以更过名称查看文件内容

git cat-file -p 210a3e5558a2c25c0a577a3f2555c2f82e5529c6

对象是 zlib 压缩而成, 后面看下如果生成一个 objects 对象

# refs

heads 下面显示所有的本地分支所在的版本号 remotes 下面显示所有的远程分支所引用的版本号

# heads/master
68c4ecb50a908b982e65f7764b72dab1cc15a4b1

# index

暂存文件,二进制,查看方式如下

git ls-files --stage