GIT / A CONCEPT NOTE
Commits & the DAG
history as a graph
Overview · mechanism
pitfall · examples
01 / THE SHORT VERSION
The idea in a few sentences.
Git tracks project history as a Directed Acyclic Graph (DAG). Commits are snapshot nodes pointing to parent commit hashes, creating a traceable history tree.
02 / FOLLOW THE MECHANISM
How commits record snapshots
File modify
user edits code files in active workspace.
Git commit
creates new commit node storing diff, timestamp, author, and parent SHA.
Graph link
new commit hash points back to previous parent commit hash.
Branch head
current branch tag (like main) updates, pointing to the new commit SHA.
04 / COMMAND NOTES
Read the command, then the result.
Inspect the flags and arguments before trying an example. Snippets can need local setup, replacement values, or resources in your own environment.
visualize the git repository history DAG in terminal
git log --graph --oneline --allinspect raw git object content contents
git cat-file -p COMMIT_SHA05 / CHECK YOURSELF
Could you explain Commits & the DAG to a teammate?
Try it out loud in two sentences: what it is, and the one detail that changes the picture. If you stall, the gap is the part to reread.
Up next in Git & collaborationBranching & Mergingparallel work, one history