Git Fundamentals
Cheat sheet · https://pcornel.dk/topic.php?topic=5465
Answer
Git Fundamentals explains the core Git state model: objects, commits, refs, HEAD, index, working tree and remotes, and how changes move between those boundaries.
Remember
- File modified ≠ file staged; the index can contain a different version from both worktree and HEAD.
- Commit recorded ≠ branch published; local refs can advance without any remote update.
- HEAD name ≠ immutable identity; branch names move while commit IDs identify snapshots.
- Repository object integrity ≠ project correctness; valid Git objects can contain broken automation or code.
First checks
git --version— versiongit config --list --show-origin— configgit status— state
Verify in this order
working tree → index → commit → remote
Where it usually breaks
Git can prove which bytes and ancestry a commit represents, but cannot prove those bytes are operationally correct or deployed.
Input/desired state → request accepted → job/task terminal status → target object read-back → effective runtime state → original workload → regression/rollback readiness.
Git Fundamentals Git boundary map
| Boundary | Healthy evidence | Suspicious evidence |
|---|---|---|
| Local state | Repository, HEAD, worktree/index and commit IDs are explicit | Wrong repo/ref, hidden staged/untracked state or mutable-name ambiguity |
| History / refs | Ancestry and branch/tag movement match intent | Unexpected rewrite, stale tracking ref or unclear merge base |
| Remote sync | URL/refspec, auth and remote read-back match expected commits | Local assumptions, rejection, stale fetch or unsafe force update |
| Downstream proof | Build/reconciliation/target is verified independently | Push/tag/merge success treated as deployment success |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5465