Git computes SHA-1 of: {type} {size}\0{content}
.git/HEAD → ref: refs/heads/main
.git/refs/heads/main → a1b2c3d...
.git/refs/tags/v1.0 → d4e5f6a...
.git/refs/remotes/origin/main → b7c8d9e...
.git/ ├── HEAD # Current branch pointer ├── config # Repository config ├── description # GitWeb description ├── index # Staging area (binary) ├── objects/ # Content-addressable store │ ├── a1/ # First 2 hex chars of SHA │ │ └── b2c3d4... # Remaining 38 chars │ ├── info/ │ └── pack/ # Packed objects ├── refs/ │ ├── heads/ # Branch tips │ │ ├── main │ │ └── feature │ ├── tags/ # Tag refs │ └── remotes/ # Remote tracking │ └── origin/ │ └── main ├── hooks/ # Git hooks scripts ├── info/ │ └── exclude # Local .gitignore └── logs/ # Reflog entries ├── HEAD └── refs/
git add → updates index, creates blobsgit commit → creates tree + commit objectsgit branch → creates/moves refgit checkout → updates HEAD + working treegit merge → creates merge commit (2 parents)git log → walks commit graphgit hash-object → compute SHA-1 + store blobgit cat-file → read object contentgit update-index → add file to staging areagit write-tree → create tree from indexgit commit-tree → create commit from treegit update-ref → set a ref to a SHAgit rev-parse → resolve ref to SHAgit ls-tree → list tree entriesgit ls-files → list index entriesgit add file.txt && git commit -m "msg"