# Reading history: messages, diffs and blame

> How to open a file's history, read a diff line by line and use blame to trace any line back to its commit, pull request and issue.

- Course: [Git and GitHub for Product People](https://productovi.com/courses/git-for-product.md)
- Module: Git in plain words
- Lesson 3/15, ~27 min
- Source: https://productovi.com/courses/git-for-product/reading-history-diffs-and-blame

## The history of one file

**Alex Tutor:** Last time we found the price change on CatChow's website through the file list. Today we do it properly, the way you'll handle any "who changed this and why?" question on the product team.

**Alex Tutor:** Open `config/prices.json`. In the top right corner of the file there's a `History` button. It lists every commit that ever changed this one file.

**Sofia:** Only eleven commits, grouped by date. And the newest is at the top, like you warned.

**Alex Tutor:** Right: GitHub lists history newest first, while our diagrams run oldest first. Engineers see the same list in the terminal with `git log`.

**Alex Tutor:** The whole repository has hundreds of commits, but a file's history is short and focused. That's usually the fastest way in.

![In front of a tall bookshelf packed with thick volumes, a person pulls out one slim folder.](https://productovi.com/courses/git-for-product/inline/reading-history-diffs-and-blame-illustration-2.webp)

> **Exercise:** You need every change made to `config/prices.json` this year. What do you open?

## File history vs branch history

**Alex Tutor:** Here's why the file view is so handy. These are the last six commits on `main`; only the two highlighted ones touched `config/prices.json`.

```text
Commit graph, oldest first: Last six commits on `main`
1. commit 5b8f3a2 on main "Update cat food photos"
2. commit 77c1e90 on main "Add express delivery price" (highlighted)
3. commit 9d04e61 on main "Fix typo in footer"
4. commit a41c09e on main "Raise delivery price to 59 UAH" (highlighted)
5. commit e7c3b19 on main "Add summer promo banner"
6. commit f02a6d4 on main "Update FAQ answers"
```

*The file's History would list only the two highlighted commits, newest first.*

**Sofia:** So the branch history is everything the team did, and the file history is just the slice that matters for my question.

**Alex Tutor:** Exactly: the same commits, filtered differently. The branch history also has filters by author and by date, for when you know who or when but not where.

**Alex Tutor:** Now a case where you know who and roughly when, but not which file.

> **Exercise:** Marketing says Daniel, a CatChow web developer, changed "something on the site" last Tuesday, but nobody knows which file. Where do you start?

## Reading a diff

**Alex Tutor:** Click a commit in that list and you get its **diff**: what changed compared with the previous version. Here's the one from `a41c09e`.

> **Diff of `config/prices.json` in commit a41c09e**
>
> ```diff
>    "currency": "UAH",
> -  "delivery": 49,
> +  "delivery": 59,
>    "freeDeliveryFrom": 800
> ```
> A line starting with `-` (red on GitHub) was removed, a line with `+` (green) was added. Lines without a sign are unchanged context.

**Sofia:** So the line wasn't edited, it was removed and added again?

**Alex Tutor:** That's how diffs show an edit: the old version in red, the new one in green, and GitHub highlights the exact characters that differ. The grey lines around it are context, so you know where you are in the file.

**Alex Tutor:** At the top of each file GitHub also shows counters like `+1 −1`: lines added and removed. And a `Split` view puts the old version on the left and the new one on the right, if that reads easier.

> **Exercise:** Match each part of a diff with its meaning.

**Alex Tutor:** Sofia's question about the "removed and added again" line is worth one more check.

> **Exercise:** When a line is edited, the diff shows it twice, the old version as a removed line and the new version as an added line.

## A bigger diff

**Alex Tutor:** Prices are one-liners. Copy changes look richer. Here's a real one from the delivery FAQ that marketing asked for last month.

**Sofia:** Show me. I want to see if I can read it without help.

**Alex Tutor:** Go for it. Read the minus lines first, then the plus lines, then count what's new.

**Sofia:** Minus lines first, then plus lines, then count. Got it.

**Alex Tutor:** One tip: the file name above the diff matters. The same sentence can live in two places, and a diff always belongs to one file.

> **Exercise:** Here is the diff of `pages/faq/delivery.md`:
>
> ```diff
>  ## Delivery
> -Orders arrive in 2–3 days.
> +Orders arrive in 1–2 days in Kyiv and 2–4 days elsewhere.
>  Free delivery from 800 UAH.
> +Express delivery: 99 UAH.
> ```
>
> Which statements are true? Select all that apply.

## Blame: who touched this line last

**Sofia:** History works when I know the file. But what if I'm staring at one specific line and want its story?

**Alex Tutor:** Then switch the file view from `Code` to `Blame`. Next to every line GitHub shows the last commit that changed it: author, message and date, plus a colour strip from older to newer.

**Sofia:** "Blame" sounds a bit aggressive for a team tool.

**Daniel:** It's an old name, and nobody uses it to point fingers. I run blame on my own code all the time, mostly to find out what past me was thinking.

**Alex Tutor:** Think of it as "where did this line come from?". In the terminal it's `git blame`; on GitHub it's one button.

![A detective with a magnifying glass follows paw prints back from one highlighted line on a big page to a small house, where a developer waves.](https://productovi.com/courses/git-for-product/inline/reading-history-diffs-and-blame-illustration-3.webp)

*The question is not who is at fault, but where this line came from.*

> **Exercise:** In the `Blame` view, what does GitHub show next to each line?

## From a line to the reason

**Alex Tutor:** Now the full chain for our price. Blame on `"delivery": 59` shows commit `a41c09e`. Its message ends with `(#128)`, the pull request. And the PR says "Closes #120", the issue finance opened.

```text
From one line to the reason behind it
- [Commit] a41c09e Raise delivery price to 59 UAH: What changed, who and when (found with Blame)
- [Merged] Raise delivery price after courier rate change #128: The discussion: why, who reviewed it, when it was merged
- [Closed as completed] Courier rates up from 1 June #120: Where the request came from: finance
```

**Sofia:** Line, commit, pull request, issue. Four clicks, and I have the whole story with the finance reasoning attached.

**Alex Tutor:** That's the move. The commit tells you what and when; the pull request and the issue tell you why and who agreed.

**Daniel:** That's also why I end commit messages with `(#128)` and write `Closes #120` in pull requests. Without those links the trail stops at the commit, and you're back to asking around.

> **Exercise:** Put the steps in order to find out why a line in `config/prices.json` looks the way it does.

**Alex Tutor:** Daniel's habit of writing `Closes #120` does more than leave a link. Let's see what.

> **Exercise:** Daniel writes `Closes #120` in the description of pull request #128. What happens when #128 is merged into `main`?

## The blame trap

**Daniel:** One warning. Blame shows the last commit that touched a line, and sometimes that commit only moved or reformatted it.

**Daniel:** Say I re-indent the whole prices file. Blame then shows me on every line, with "Reformat prices.json", even though I didn't change a single price.

![A person peels back a strip of fresh paint on a fence to reveal older carvings underneath.](https://productovi.com/courses/git-for-product/inline/reading-history-diffs-and-blame-illustration-4.webp)

**Sofia:** So how do I get past that?

**Alex Tutor:** Next to each commit in the blame view there's a small icon, `View blame prior to this change`. It shows the same file as it was just before that commit. Or open the file's `History` and look one step further back.

> **Exercise:** Blame on the line `"freeDeliveryFrom": 1000` shows the commit "Reformat prices.json", which only changed indentation. How do you find the commit that actually set the value to 1000?

## Closing the case

**Alex Tutor:** Time to close the support ticket. Their question was: why does delivery cost 59 UAH now instead of 49?

**Sofia:** And I can answer with facts, not guesses: the commit, the pull request and the issue.

**Alex Tutor:** Write it so a support agent can copy it straight to a customer. Short, friendly, no Git words.

**Daniel:** And if you mention the date, take it from the PR, not from memory. Mine is terrible.

> **Exercise:** From the history you found: commit `a41c09e` "Raise delivery price to 59 UAH" (merged on 3 June), PR #128 "Raise delivery price after courier rate change", issue #120 "Courier rates up from 1 June" opened by finance. Write a 2–3 sentence answer support can send to a customer asking why delivery now costs 59 UAH instead of 49.

**Alex Tutor:** Quick recap of your toolkit: `History` for every change to a file, the diff for exactly what changed, `Blame` for where a line came from, and the linked pull request and issue for why.

**Alex Tutor:** If an engineer ever sends you a terminal command for this, like `git blame`, our [Git cheat sheet](/tools/git-cheat-sheet#who-why) translates it into these same buttons.

**Alex Tutor:** Case closed, and module 1 done: you can read a repository, a commit and its history. Next module: branches, where parallel work lives.

**Sofia:** And where Daniel broke the checkout button, I suspect.

**Daniel:** Allegedly. And it was fixed within ten minutes, as the history will happily show you.

- Previous lesson: [Repository and commits: reading a GitHub repo page](https://productovi.com/courses/git-for-product/reading-a-repository-page.md)
- Next lesson: [Git branches: parallel versions of the project](https://productovi.com/courses/git-for-product/branches.md)

---
Productovi Learning. Free, no sign-up needed to read.
