TOPIC GIT
Commits & the DAG history as a graph
IN 10 SECONDS
Git tracks project history as a Directed Acyclic Graph (DAG). Commits are snapshot nodes pointing to parent commit hashes, creating a traceable history tree.
GOTCHA Git does not store files as lines of code differences. It stores them as compressed filesystem snapshots (blobs), making checkouts fast.
HOW COMMITS RECORD SNAPSHOTS
01 File modify user edits code files in active workspace.
02 Git commit creates new commit node storing diff, timestamp, author, and parent SHA.
03 Graph link new commit hash points back to previous parent commit hash.
04 Branch head current branch tag (like main) updates, pointing to the new commit SHA.
POKE IT YOURSELF
git log --graph --oneline --all — visualize the git repository history DAG in terminal
git cat-file -p COMMIT_SHA — inspect raw git object content contents
Drill this topic →
~65 sec read