diff

A listing of the differences between two versions of something, such as two files, two commits or two screenshots.

In more detail

For text, a diff shows removed lines with a minus sign and added lines with a plus sign, grouped into hunks. Image diffs highlight the pixels that changed instead. A diff tells you what changed, but not who changed it, when or why.

Examples

ansible-playbook --check --diff preview.yml shows the lines a task would change.
diff <(head -2 poem.txt) <(tail -2 poem.txt)
Playwright writes a diff image when a screenshot no longer matches its baseline.
For live regions the course uses the word for the changed part of the text, which aria-atomic avoids reading on its own.
diff report-final.md report-final-v2.md
git diff --staged
git diff go.mod  # after go mod tidy, a dependency review
Review the generated client diff after an OpenAPI edit.
Diffing today's autostarts, services or accounts against a known good baseline surfaces the few new entries worth reading, instead of hundreds of normal ones.
The course wants unsafe choices to be visible in a diff so reviewers see them, and it asks you to read a lockfile diff carefully, because a new package name there is a new publisher you have never evaluated.
terraform fmt -diff
In Terraform: Because infrastructure as code lives in text files, every change can be shown as a diff and reviewed. The terraform fmt command also takes a -diff flag to show what it reformatted. A Terraform plan is similar in spirit, but it lists actions on real infrastructure rather than changed lines.
In this course: Code review reads a change as a diff. pytest prints a diff when two lists, dictionaries or long strings compare unequal, marking the missing or extra items.

Related terms

Taught in

References

Certification courses