Diagramium
🌿 Narrated diagram

Git: where your changes actually live

Untracked, ignored, staged, committed, stashed, pushed, merged — every state a file passes through in Git, and the exact command that opens each door.

12 steps3 min readNarrated with a studio voice
Git: where your changes actually livematched by a gitignore rulegit addgit commityou edit the filegit addgit stashgit stash popgit pushgit pull brings other workresolve, then git committhe pull request is approvedgit reset --hardgit reflog, then git checkoutthirty days, then git gcThe pseudostate a machine starts fromA state — optionally with entry / exit / do behaviorUntrackeddo / Git sees the file but takes no responsibility for itA state — optionally with entry / exit / do behaviorIgnoreddo / matched by a rule, never offered to you againA state — optionally with entry / exit / do behaviorStageddo / a draft snapshot waiting in the indexA state — optionally with entry / exit / do behaviorCommitteddo / sealed into your local history under a hashA state — optionally with entry / exit / do behaviorModifieddo / your working copy differs from the last commitA state — optionally with entry / exit / do behaviorStasheddo / parked on a hidden stack, out of the wayA state — optionally with entry / exit / do behaviorPusheddo / a copy finally exists somewhere other than your laptopA state — optionally with entry / exit / do behaviorConflicteddo / two histories edited the same linesA state — optionally with entry / exit / do behaviorMergeddo / part of the shared history everyone pullsA state — optionally with entry / exit / do behaviorOrphaneddo / still on disk, but no branch points at itThe state machine has completedCollected
Git: where your changes actually live — the complete diagram. Press Present to watch it build itself.
Step 1 of 12

Git does not really track files, it tracks snapshots. At any moment every file on your machine sits in exactly one state, and a small handful of commands are the only doors between those states. This is the entire map, and it is smaller than most people expect.

Step 2 of 12

Untracked

A brand new file is untracked. Git can see it sitting there, but flatly refuses to take responsibility: it will not appear in any commit, and if you delete it tonight nothing will warn you and nothing will bring it back. It is a guest, not a resident.

Step 3 of 12

Ignored

Some files should never be tracked at all: build output, log files, the folder of downloaded libraries that can easily weigh hundreds of megabytes. A single ignore rule makes Git skip them silently forever, which is why almost every project creates one on day one.

Step 4 of 12

Staged

Staging is the step newcomers find strange, and it is Git's best idea. The index is a draft commit you assemble piece by piece. You can even stage half of one file, so a single messy afternoon of work becomes two clean, separate, reviewable commits.

Step 5 of 12

Committed

Committing writes a permanent snapshot into a hidden folder inside your own project, named by a forty character hash of its own contents. Change one comma anywhere and the hash is entirely different, and that is precisely what makes Git history tamper evident.

Step 6 of 12

Modified

Open the file, type one character, and it becomes modified: your working copy no longer matches the last commit. Git screens candidates by size and modification time, then settles it by hashing the actual content, which is why touching a file without changing it leaves Git completely unimpressed.

Step 7 of 12

Stashed

Stashing is the escape hatch for the moment a colleague asks you to look at something urgent right now. It sweeps your half finished changes onto a hidden stack, hands you back a clean working copy, and holds everything until you pop it out again.

Step 8 of 12

Pushed

Pushing is the first moment your work exists anywhere except your own machine. Until then no backup, no teammate and no server has a single copy of it. If the laptop dies tonight, everything you have not pushed dies with it.

Step 9 of 12

Conflicted

A conflict is not an error, it is Git refusing to guess. When two people change the same lines, it writes both versions into the file and stops. Note the precision: different parts of the same file merge silently, and only overlapping lines ever need a human.

Step 10 of 12

Merged

Merging joins your branch into the shared history, and it leaves a distinctive mark: a merge commit is the rare one that points back at two parents instead of one. If nothing else moved meanwhile, Git skips even that and simply slides the branch label forward. Most teams put a review in front of this door.

Step 11 of 12

Orphaned

Now the part that saves careers. A hard reset appears to destroy commits, but they are still sitting on disk, merely unreachable because no branch points at them any more. The reflog is a private diary of every position your branch has ever held, and it hands them straight back.

Step 12 of 12

Collected

Only after roughly thirty days does Git's garbage collector finally delete what nothing points to. So the honest rule is this: once something is committed it is remarkably hard to lose, and everything before that first commit Git never knew about in the first place.

Watch it explain itself

Every step above is narrated aloud. Play it, or open it in the editor and make it yours — no account needed.