Skip to content
Log in
← Glossary

diff

Also called: diffs

A view of what changed between two versions: removed lines in red with a minus, added lines in green with a plus.

A diff answers "what exactly changed?". It compares two versions line by line: lines that were removed are shown in red with a minus, lines that were added in green with a plus, and a few unchanged lines around them give context. A changed line appears as one removal and one addition. GitHub shows a diff on every commit page and in a pull request's Files changed tab; a split view puts the old and new versions side by side.

Example

The diff of Daniel's commit a41c09e shows one red line, "delivery": 49, and one green line, "delivery": 59, in config/prices.json.

Common mistakes

Reading only the lines of the diff and missing what is not there: a change to the price without the matching change to the FAQ text is a gap you only notice by thinking about what else should have changed.

Learn it in the course

  • 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.
  • Approve a pull request as a PM: comments and suggestions · What a product person checks in a pull request and what to leave to engineers, how to comment on a line, suggest changes with the exact wording, decide when to approve a pull request or request changes, and write review comments people are glad to get.
  • Repository and commits: reading a GitHub repo page · What a repository in GitHub is, its page from top to bottom, what a single commit tells you, and commit message best practices.
  • What is a pull request? Anatomy of a PR page · What a pull request is, read top to bottom: base and compare branches, draft and ready, the four tabs, the description and a pull request template, reviewers and labels, linked issues, checks and the merge box.
  • Your first change in the browser, and how to revert it · Make a small change entirely in the GitHub web UI: find the file, edit it in the GitHub web editor, commit to a new branch because main is protected, open a pull request, pass checks and review, merge and deploy. Then undo a merged change with GitHub's Revert button, learn when to revert and when to fix forward, and what a PM should and shouldn't edit.