git log: read the album
Every save point, newest first. Learn to read the entries.
git log walks the album from newest to oldest — each entry is a photograph with an ID, an author, and your message.
01The full log
git log prints the album, newest photograph first. Each entry shows four things: the commit's full ID, the author, the date, and the message. It is verbose — deliberately so, because it is the honest, complete record. You will read it thousands of times in your life.
The order is newest-first, like a social feed. That is not a random choice: when you are hunting a bug, the newest commits are the usual suspects, so git puts them at the top where you start reading.
git log02The short version you will actually use
Adding --oneline squeezes each photograph down to a single line: the short ID, then the message. This is the form developers use ninety percent of the time — a quick scan of the whole story of the project, one save per line.
The short ID is not a different ID — it is the first seven characters of the full one, and seven characters is enough to identify any commit in any project you will ever build. Git accepts the short form anywhere it asks for a commit.
git log --onelineThe ID is a checksum — a fingerprint calculated from the photograph's exact content. Identical content gives an identical fingerprint, different content always differs. That is how git can guarantee that a commit, once made, can never silently change.
03The strange decoration
Beside the newest commit you will see (HEAD -> main). Decode it right-to-left: main is the label of your one line of history, and HEAD is git's word for where you are standing right now. Together: you are standing at the tip of main. When branches arrive in course 14, this decoration becomes genuinely useful — you will watch it move, and it will always tell you exactly where you are.
a1b2c3d (HEAD -> main) add shop file
f4e5d6 (HEAD -> main) start shopping listWhenever you see HEAD, read it as where I am standing right now. Git uses it everywhere, and it always means exactly that.
Practice
There is already one save point in the album. Add a second, then look at both.
01.Change notes.txt to say something new.
hint: Try: echo "version two" > notes.txt
02.Stage the change and commit it.
hint: git add . then git commit -m "second"
03.Look at the history with git log.
hint: Try: git log — or git log --oneline