⛓️ History: photos chained together

By the end of this page you will know exactly what "history" is, and you will see that git never has to keep a list at all.

1The chain appears by itself

In the last lesson you learned that every save point is a photo of all your files, plus a sticky note saying what changed. Here is the part most people miss: every photo also remembers which photo came right before it.

That tiny detail does something wonderful. Nobody has to file anything. Nobody keeps a list. The photos line up into a chain on their own, simply because each one points back to the one before it.

⛓️ It is like beads on a string. Each new bead is threaded behind the last one, so the necklace stays in order without anyone sorting it. Or think of a paper trail where every page ends with "continued from page 4". You never need a table of contents. The pages connect themselves.

So when you make your tenth save point, you are not adding a row to some spreadsheet. You are clipping one more bead onto a string that already exists. The links ARE the filing system.

2Your real chain, right now

This is not a made up example. These five beads are real save points from your own project, made this week. Oldest on the left, newest on the right.

e909d5d fixed citations d4cd26a email review tool 836f2de finished content db039fb review fixes f30f6b7 todo update oldest newest Real save points from your own project, made this week. Each arrow means "my previous photo is that one."

Five photos, four links, one chain. You built this without ever thinking about it. Every time you saved, git quietly threaded one more bead.

3Reading history is just walking the chain

How does git show you the story of your project? It does something a child could do with the necklace above.

It picks up the newest photo, f30f6b7 "todo update", and asks: "what came before you?" The photo answers: db039fb. So git hops there and asks again. Hop. Hop. Hop. Four hops later it reaches e909d5d "fixed citations", the oldest bead in our picture. The real chain keeps going past the edge of the diagram, hop after hop, all the way back to your project's very first photo, the only one with nothing before it. That is where the walk ends.

That is the entire trick. There is no clever index, no hidden database of dates. Start at the newest photo, keep asking "and what came before you?", and the whole story falls out in order.

4The arrows point backwards, and that matters

Look at the diagram again. The arrows go from right to left, from newer to older. That is not an artistic choice. It is how git really works, and it is worth ten seconds of your time.

A new photo can know its past, because the past already existed when the photo was taken. But an old photo can never know its future. The moment you took it, it was sealed: files, sticky note, and a pointer to its parent. Nothing that happens later can reach back inside it and edit it.

This is why committed work is so hard to lose. Old photos are sealed and untouchable. New photos only ever get added to the front of the chain. Once something is on the string, it stays on the string. Relax.

5Now you get the official words

🗣 Git's word for this chain is "history." The photo that came before a save point is called its "parent." And the command that walks the chain for you, hop by hop, is "git log."

Here is what git log shows for the exact chain you saw above. One line per photo, and notice the order:

git log --oneline
# newest first, just like your email inbox
f30f6b7 todo update
db039fb review fixes
836f2de finished content
d4cd26a email review tool
e909d5d fixed citations
# ...and it keeps going: older photos continue below these five

The --oneline part just means "keep it short, one line per photo." Without it you get the full sticky note for each one: who, when, and the whole message.

6Try it, then check yourself

⌨️ Try it yourself

Open Terminal in any folder that uses git, your real project is fine, and look at its chain. Looking never changes anything, so this is completely safe.

git log --oneline
# scrolling through this = flipping through the photo album
# if it opens a long scrolling view, press q to quit

Use the arrow keys to wander back in time. Every line is a sealed photo you could return to. Press q when you are done.

Q. How does git produce the history list?

There is no list and no spreadsheet. Each commit points to its parent, so git just hops backwards along the chain, newest to oldest, and prints what it finds.

One more to think about: could git ever show the photos in the wrong order?

No. The order is not stored as dates that could lie or get mixed up. The order IS the chain of links: each photo permanently points to its parent, so the sequence is built into the photos themselves. Git is not remembering the order. It is reading it off the necklace.
🧠 If you remember one thing: history is not a list git maintains; it is the chain your photos form on their own, each one pointing back to its parent.