BBobop Git Internals

index tools

Create Git Objects

Blob Object (file content)
Tree Object (directory)
Add blobs first, then create a tree from them
Commit Object
Tree:
Parent: none

Object Store

How Git Hashes Objects

Git computes SHA-1 of: {type} {size}\0{content}

Hash Breakdown
SHA-1 Computation Steps
Commit Details
Click a commit node to see details
References (Pointers to Commits)
How Refs Work
HEAD — Points to current branch (symbolic ref)
.git/HEADref: refs/heads/main
Branch — Mutable pointer to a commit
.git/refs/heads/maina1b2c3d...
Tag — Immutable pointer to a commit
.git/refs/tags/v1.0d4e5f6a...
Remote — Tracks remote branch state
.git/refs/remotes/origin/mainb7c8d9e...
.git Directory Structure
.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/
Plumbing vs Porcelain Commands
Porcelain (user-facing)
git add → updates index, creates blobs
git commit → creates tree + commit objects
git branch → creates/moves ref
git checkout → updates HEAD + working tree
git merge → creates merge commit (2 parents)
git log → walks commit graph
Plumbing (low-level)
git hash-object → compute SHA-1 + store blob
git cat-file → read object content
git update-index → add file to staging area
git write-tree → create tree from index
git commit-tree → create commit from tree
git update-ref → set a ref to a SHA
git rev-parse → resolve ref to SHA
git ls-tree → list tree entries
git ls-files → list index entries
Interactive: git add + git commit breakdown
See what happens internally when you run git add file.txt && git commit -m "msg"