← Home ← Codex ← DEBT
Browse by Category
+ added · updated 7d
← Back to glossary

Git Internals

Git Advanced
debt(d9/e7/b5/t7)
d9 Detectability Operational debt — how invisible misuse is to your safety net

Closest to 'silent in production until users hit it' (d9). The detection_hints explicitly state 'automated: no' and the only tool listed is git itself (plumbing commands). Misunderstandings about the object model surface only when developers encounter unexpected behaviour — force-push disasters, lost-looking commits, confusing rebase results — all of which are silent until the moment of impact in production workflows.

e7 Effort Remediation debt — work required to fix once spotted

Closest to 'cross-cutting refactor across the codebase' (e7). The quick_fix is conceptual, not a one-line patch — it requires re-educating developers and potentially revisiting branching strategies, rebase vs merge policies, and CI/CD pipeline assumptions. Misunderstandings rooted in wrong mental models (diffs vs snapshots, branch deletion, merge parents) require updating practices across a team and codebase workflow, not just a single file change.

b5 Burden Structural debt — long-term weight of choosing wrong

Closest to 'persistent productivity tax' (b5). Applies to 'any' context per applies_to, meaning every developer on every project using git carries this conceptual load. However, it doesn't fully define system shape (b7/b9) — it's a persistent tax on debugging, onboarding, and workflow decisions rather than an architectural constraint that shapes every change.

t7 Trap Cognitive debt — how counter-intuitive correct behaviour is

Closest to 'serious trap (contradicts how a similar concept works elsewhere)' (t7). The canonical misconception — 'Git stores file diffs' — is directly contradicted by how most other VCS tools (SVN, CVS) actually work, making the wrong assumption feel natural to developers migrating from those systems. The common_mistakes reinforce this: branch deletion not deleting commits, and merge commit dual-parent behaviour, are all non-obvious traps that contradict intuitive expectations.

About DEBT scoring →

Also Known As

git object model git DAG git plumbing

TL;DR

Git stores all data as content-addressed objects (blobs, trees, commits, tags) in a directed acyclic graph — understanding this explains every git command's behaviour.

Explanation

Git's object model: blobs store file content, trees store directory listings, commits point to a tree plus parent commits and metadata, tags point to commits. Every object is named by the SHA-1 hash of its content. Branches and tags are simply pointers (refs) to commit hashes. HEAD points to the current branch or commit. This model explains why branches are cheap (just a file with a hash), why git is fast (content addressing), and why history rewriting changes hashes.

Diagram

flowchart TD
    subgraph Git Objects
        BLOB[Blob<br/>file content]
        TREE[Tree<br/>directory listing]
        COMMIT[Commit<br/>tree + parent + message]
        TAG[Tag<br/>points to commit]
    end
    COMMIT -->|points to| TREE
    TREE -->|contains| BLOB
    TREE -->|contains| TREE2[Subtree]
    COMMIT -->|parent| PREV[Previous commit]
    subgraph Refs
        HEAD[HEAD] -->|points to| BRANCH[branch name]
        BRANCH -->|points to| COMMIT
    end
    INFO[Everything is content-addressed<br/>SHA-1 hash of contents<br/>immutable once written]
style COMMIT fill:#6e40c9,color:#fff
style TREE fill:#1f6feb,color:#fff
style BLOB fill:#238636,color:#fff
style INFO fill:#d29922,color:#fff

Common Misconception

Git stores file diffs — git stores complete snapshots of files (blobs) at each commit; deltas are only used in packfiles for storage efficiency.

Why It Matters

Understanding git's object model explains why rebase changes commit hashes, why force push is dangerous, and how to recover 'deleted' commits with reflog.

Common Mistakes

  • Thinking git stores diffs — it stores full snapshots; packfiles compress them later.
  • Not understanding that branch deletion does not delete commits — unreferenced commits are garbage collected eventually.
  • Not using git cat-file to inspect objects when debugging — the plumbing commands reveal what high-level commands hide.
  • Not understanding that a merge commit has two parents — this is what makes merge vs rebase history different.

Code Examples

✗ Vulnerable
# Losing work by assuming branch deletion removes commits:
git branch -D feature/experiment
# The commits still exist! They are just unreferenced.
# Recover with: git reflog | grep 'feature/experiment'
# git checkout -b recovered <hash>
✓ Fixed
# Inspect git objects directly:
git cat-file -t HEAD        # Shows type: commit
git cat-file -p HEAD        # Shows: tree, parent, author, message
git cat-file -p HEAD^{tree} # Shows directory listing
git log --graph --oneline --all  # Visualise the DAG

Added 15 Mar 2026
Edited 22 Mar 2026
Views 49
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
0 pings T 0 pings W 1 ping T 0 pings F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W 0 pings T 2 pings F 0 pings S 2 pings S 1 ping M 1 ping T 0 pings W 0 pings T 0 pings F 0 pings S 0 pings S 1 ping M 0 pings T 0 pings W 2 pings T 0 pings F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W
No pings yet today
No pings yesterday
Amazonbot 7 Perplexity 6 Google 5 Ahrefs 5 Scrapy 4 ChatGPT 3 SEMrush 3 Claude 2 Majestic 1 Sogou 1
crawler 34 crawler_json 3
DEV INTEL Tools & Severity
🔵 Info ⚙ Fix effort: Medium
⚡ Quick Fix
Understanding git objects (blob, tree, commit, tag) explains why git operations are fast — commits are just pointers to tree snapshots, not diffs; this explains why branches are cheap and merges are efficient
📦 Applies To
git any
🔗 Prerequisites
🔍 Detection Hints
Confusion about why git is fast; misunderstanding of what a branch is; unexpected behaviour from reflog or object model
Auto-detectable: ✗ No git
⚠ Related Problems
🤖 AI Agent
Confidence: Low False Positives: High ✗ Manual fix Fix: Medium Context: File


✓ schema.org compliant