Looking at the Log
Every commit you make goes into a list, and git log is how you read it. Newest first, one entry per commit, going back to the beginning of the project.
This is the payoff for Chapter 2's insistence on writing real messages. A log full of "fix" is a list of things you did and cannot remember; a log of plain sentences is a description of how the project got here.
The default view
git log
Each entry shows four things — a long identifier, an author, a date, and the message:
commit a3f9c21b7e5d4c8f2a1b6e9d0c3f7a5b8e2d4c60
Author: Your Name <you@example.com>
Date: Thu Aug 14 09:12:44 2026 +0200
Fix the meeting time on the home page
Those four things are exactly the four questions from the first page of this book. What changed is one command away, when and who are printed here, and why is the message you wrote.
Getting out of the pager
If the history is longer than the screen, Git hands the output to a pager — a small program for reading long text. The terminal appears to stop responding, which is the single most common "Git has frozen" moment in a beginner's first week.
It has not frozen. Press Space or the arrow keys to move, and press q to quit. That is all there is to it, and it applies to every Git command that produces a lot of output.
The identifier
That forty-character string is the commit's name, called a hash. It is generated from the commit's own contents, which is why every commit has a different one.
You will never type all forty characters. The first seven are enough to identify a commit in any project you are likely to work on, and that is what every command in this book accepts:
git show a3f9c21
One thing to unlearn immediately: a hash is not a version number. a3f9c21 tells you nothing about whether it came before or after 9e2b70f. Order comes from the chain of commits, which is what the log is printing.
Making it readable
The full view is thorough and unwieldy. This is the one you will actually use:
git log --oneline
c8d1e07 Fix the meeting time on the home page 5b2a9f3 Add basic styling for the home page a3f9c21 Add the club home page
Short hash, first line of the message, nothing else. Three commits that read as three sentences — and this view is precisely why Chapter 2 cared so much about that first line, since nothing else is shown here.
Add -5 to see only the last five entries, which is usually what you want on a real project:
git log --oneline -5
One file's history
On a project with any history at all, the useful question is usually narrower than "everything". Two dashes and a filename limit the log to commits that touched that file:
git log --oneline -- index.html
That answers "when did this page last change" in about two seconds. Git can also search history by message text and by author, and those are worth knowing about later; this book stops here because these three forms cover the first six months.
What the log does not show
git log shows the history and only the history. Your uncommitted work is not in it, because it has not been recorded — that is what git status and git diff are for.
If something you wrote is not in the log, the question is not "where did Git put it" but "did I commit it". Almost always, the answer is no.
- "My terminal has frozen." It is the pager waiting for you. Press
qto quit, arrows orSpaceto scroll. Nothing is stuck and nothing is running. - "The hash is a version number." Hashes have no order at all.
a3f9c21could be older or newer than9e2b70f; only the chain of commits knows, and the log is what prints it. - "
git logshows what I am working on." It shows what has been committed. Uncommitted work lives ingit statusandgit diff, which is the distinction the whole of Chapter 2 was building. - "I need to write down the full forty-character hash." The first seven characters identify a commit in any normal project, and every command in this book takes the short form.
- Reading history is how you answer "when did this break", which is the question you will actually have at work — and every recovery command in Chapter 4 takes a commit identifier from here.
- The short hash is the handle used by
show,revert, and every conversation anyone has about a specific change. - Knowing how to leave the pager removes a genuinely demoralizing first-week obstacle that has nothing to do with Git itself.
Knowledge Check
Your terminal stops responding after git log. What is going on?
- The pager is waiting for you to read the output; press
qto leave it - Git is still calculating the history and will finish shortly on its own
- The repository is damaged, so the command cannot complete or return control
- Another Git command holds a lock, and this one is queued behind it
What does a commit hash tell you about ordering?
- Nothing at all, because order comes from the chain rather than the name
- Higher hash values are always newer, so they can be compared directly
- The first character indicates the year, so the age can be read at a glance
- Hashes increase by one for each commit, so gaps mean commits were deleted
You wrote some code an hour ago and it does not appear in git log. What is the likely explanation?
- It was never committed, so there is nothing in the history for it to show
- The log only shows commits from the last few minutes unless you ask for more
- Git hides commits made by you and shows only those made by other people
- The commit exists but is hidden until it has been pushed to a remote copy
Why does git log --oneline make the first line of a commit message so important?
- Because that view shows the first line of each message and nothing else
- Because Git truncates any message whose first line runs past fifty characters
- Because only the first line is searchable, so later lines can never be found
- Because the body of a message is discarded once the commit has been recorded
You got correct