Q1: When Was "butter" First Mentioned?
git log -S butter --oneline -- cookies.md
The -S flag (git's "pickaxe" search) finds every real commit that changed how many times a string appears in a
file — not a text search through messages, a real search through actual file content across all of history.
Q2: Who Last Touched a Specific Line?
git blame -L 3,3 cookies.md
git blame genuinely attributes every line still present in the file to the real commit that last touched it — not
necessarily the commit that first added the line, but the one currently responsible for its exact current content.
Q3: What Did It Look Like Several Commits Ago?
git show HEAD~2:cookies.md
HEAD~2 means "two commits before HEAD." Combined with :cookies.md, this shows the real, exact content of that
one file at that specific point in history — without touching the working directory or checking anything out.
A colleague messages you: "The butter quantity in the cookie recipe changed — when was it first added, and what did it used to say?" Without the right tools, you would scroll through fifteen real commits by hand. With the right tools, this takes under thirty seconds.
Every question in this lab has a real, specific, genuinely correct answer sitting in this exact repository's real history — no guessing, no scrolling, tools only.
git log -S (pickaxe search)
Searches real file content across all of history for commits that changed how many times a given string appears — genuinely different from searching commit messages, and confirmed directly in this lab to find the exact commit that first introduced a word.
git blame
Attributes every line currently in a file to the real commit that most recently changed it. Confirmed directly: a line touched by three different commits over time is attributed to the most recent of the three, not the first.
git show <hash>:<file>
Displays a file's real, exact content as of one specific commit, without checking anything out or touching the working directory — the direct, real way to answer "what did this look like back then."
Takeaways
- git log -S searches real file content across all of history — genuinely different from searching commit messages
- git blame attributes each line to whoever last changed its exact current content, not necessarily whoever first wrote it
- git show <commit>:<file> recovers a file's real, exact historical content without touching the working directory at all
- A specific, real question about history ("when", "who", "what did it look like") almost always has a specific, real, tool-answerable answer
- This closes Block 1.2: staging with intention, writing messages worth reading, splitting hunks cleanly, and reading history like a detective — the real daily work loop