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.
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.
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.
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.
Five photos, four links, one chain. You built this without ever thinking about it. Every time you saved, git quietly threaded one more bead.
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.
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.
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.
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?
One more to think about: could git ever show the photos in the wrong order?