Skip to content

Round 4: Internals

Senior, SRE and platform loops ask what Git stores and how a command changes it: what a commit hashes over, what a branch and HEAD really are, and why a design trades one property for another. Each question links to the topic file that answers it. This page grows as each module is added, and the dedicated internals module fills in the object model.


Foundations

Question Answered in
Why does changing one old commit change the id of every commit after it? What Is Git
How does Git decide which config file a value comes from? Install and Config
What does git commit do to the three trees internally? The Three Trees

Core Workflow

Question Answered in
Why does amending a commit change its SHA even if only the message changed? Staging and Committing
For git log and git diff, what do A..B and A...B each compute? Inspecting History
What does the binary attribute actually turn off, and why does it matter for merges? Ignoring and Attributes
After git reset --hard HEAD~1, is the discarded commit really gone? Undoing Changes

Branching and Merging

Question Answered in
What actually changes on disk when you create and switch a branch? Branches
What does the ort strategy compute during a three-way merge? Merging
Why does rebasing change commit SHAs while merging does not? Rebasing
How does autosquash know where to place a fixup commit? Interactive Rebase
What are the three index stages during a conflict? Conflict Resolution
How does cherry-pick apply a commit, and why is the result not identical? Cherry-Pick

Remotes and Collaboration

Question Answered in
How does Git know which remote branch your local branch tracks, and where is it stored? Remotes
How does --force-with-lease know the remote moved without seeing its live state? Pushing and Pulling
Why can an annotated tag be signed but a lightweight tag cannot? Tags and Releases
How is a stash stored, and why can you inspect it like a commit? Stashing

Team Workflows

Question Answered in
Why does gitflow merge a release branch into both main and develop? Branching Strategies
How does release tooling derive the next version from commit messages? Commit Conventions
How does git range-diff pair a reworked commit rather than matching by SHA? Code Review with Git

History and Recovery

Question Answered in
If reset --hard does not delete commits, what eventually does, and when? Reflog and Recovery
How does git bisect choose which commit to test, and why is it logarithmic? Bisect
Why does rewriting one commit change the SHA of every commit after it? Rewriting History
Why does removing a file from history change SHAs and force re-clones? Filter-Repo and Secrets

Internals

Question Answered in
What exact bytes does Git hash to produce a blob's SHA? Object Model
How does an annotated tag reach a commit, and how does rev-parse peel it? Refs and HEAD
What does the ort strategy compute during a three-way merge? How Merge and Rebase Work
How does a packfile store many versions of a file without full copies? Packfiles and GC