In the last exercise, you found the seam where a good value turns bad. However, the code at that seam can’t tell you when it started behaving that way or why someone wrote it like that. Git can. It kept every change to The Second Draft, with its author, its message, and the discussion it links to.
In this lesson, you’ll follow a puzzling line back to the commit that introduced it, read why it exists, and find the release where it arrived. That’s what you check before you change a line you don’t understand. Start with a line whose reason you already know, so you can see whether the history leads you to the same place.
Ask Blame Which Commit Touched a Line
When a line looks strange, the first question is which change put it there. You’ve met the legacy floor before. It’s in priceOrder(), on line 19 of src/orders/pricing.js. Here it is with its comment, the long line 17 broken in two:
// Keep the legacy floor: old imported discount records
// could exceed the basket.
// See docs/issues/17.md before removing it.
if (saving > paidItemsSubtotal) saving = paidItemsSubtotal;
That comment sent you to docs/issues/17.md, where Grace and Ada explained the floor. Many odd lines have no such explanation. So set the comment aside, and find the floor’s reason the way you would for any other line.
git blame prints lines of a file, each next to the commit that last changed it. Open a terminal in your second-draft-books folder, and ask about line 19 with -L 19,19, which means “from line 19 to line 19”:
$ git blame -L 19,19 src/orders/pricing.js
9dd98af0 (Edsger (fictional) 2026-11-19 12:25:48 +0000 19)
⮑ if (saving > paidItemsSubtotal) saving = paidItemsSubtotal;
The line starts with 9dd98af0, the beginning of a commit hash, the ID Git gives every commit. Then come the author, the date, and the line number. It’s tempting to conclude that Edsger wrote the floor, but blame shows only the last commit that touched a line, and a reformat, a rename, or a move touches lines without changing what they do. Asking Edsger why the floor exists could send you to the wrong person.
Check what that commit did instead. git show prints a commit’s message and its changes, and --shortstat cuts the changes down to a count:
$ git show --shortstat 9dd98af
commit 9dd98af0728babae7ae9d3a6de87f5fd48a82cf7
Author: Edsger (fictional) <[email protected]>
Date: Thu Nov 19 12:25:48 2026 +0000
Apply the team indentation style
40 files changed, 473 insertions(+), 473 deletions(-)
Changing forty files, with as many lines added as removed, fits a reformat. However, that’s only what the message claims. Check it against what the commit did to the one file you care about:
$ git show 9dd98af -- src/orders/pricing.js
...
export function priceOrder(state, lines, code) {
- let grossSubtotal = 0;
- let paidItemsSubtotal = 0;
- for (let line of lines) {
...
+ let grossSubtotal = 0;
+ let paidItemsSubtotal = 0;
+ for (let line of lines) {
...
Each ... stands for lines left out here: the commit’s header first, then the rest of each block. If Git’s output fills your screen, Git shows it one page at a time: press Space to scroll and Q to quit. Lines starting with - were removed, and lines starting with + were added.
Read the two blocks side by side. Each of the twenty-two removed lines comes back as an added line with the same code, only indented deeper. That’s what a reformat looks like, and the floor’s line is among them.
Checking that only the indentation changed is the step you’re most likely to rush. If you have Code Mentor, the button below opens it with a question about that. Paste your output of git show 9dd98af -- src/orders/pricing.js after the question, then check each pair of lines it points to against your own - and + lines: