Git
.git
HEAD
The HEAD
file points to current branch,
$ cat .git/HEAD
ref: refs/heads/main
The file refs/heads/main
point to the commit of current branch,
$ cat .git/refs/heads/main
f4e147fd5c627e985edb05059c9924e8f492311c
Config
The git config file is located at .git/config
in a repo, or ~/.gitconfig
globally.
Local configuration files take precedence over global configuration files.
Object
Objects type
- tree
- commit
- blob
# check object type
git cat-file -t 0a2bc7
# check object content
git cat-file -p 0a2bc7
# check object size
git cat-file -s 0a2bc7
Working directory & Stating area
# check stating area files
git ls-files -s
Git File Status
- untracked
- modified
- staged
- unmodified
FAQs
Get to get last commit file change summary
git diff-tree --numstat HEAD HEAD~1
git diff-tree --stat HEAD HEAD~1