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.mdgit diff --stagedgit diff go.mod # after go mod tidy, a dependency reviewReview 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 -diffIn 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
- diff mode — An option that makes modules print a before-and-after diff of each file they change, or would change in check mode.
- check mode — A rehearsal run that asks each module what it would change and stops before changing anything.
- comm — The command that compares two sorted files and prints lines unique to the first, unique to the second and common to both, in three columns.
- process substitution — The bash form <(command), which runs a command and hands its output to another program as if it were a file name.
- Kustomize overlay — A small set of per-environment changes, such as replicas or an image digest, layered on top of a shared base.
- out of sync — Argo CD's status for an Application whose live resources differ from the desired state in Git.
- Git — A free, open-source distributed version control system that records the history of a project as a chain of snapshots.
- Git hook — A script Git runs automatically at a point in its workflow, such as pre-commit, which can stop the commit by exiting non-zero.
- visual regression testing — Testing that takes screenshots of components and compares them pixel by pixel with approved baseline images to catch unintended visual changes.
- baseline snapshot — The approved reference image a visual test compares new screenshots against.
- aria-atomic — An ARIA property on a live region saying whether screen readers should read the whole region when part of it changes.
- pull request — A request on a hosting service such as GitHub to merge one branch into another, with a page for review, discussion and automated checks.
- code review — A teammate reading a proposed change before it is merged, to understand it, catch mistakes and share knowledge.
- git diff — The command that shows the differences between two of Git's states: the working tree, the staging area, or any two commits.
- hunk — One block of nearby changed lines in a diff, shown with a few unchanged lines around it for context.
- patch — A file listing line-by-line changes to source files, and the patch command that applies or reverses them.
- go.mod — The text file at the root of a Go module that records its module path, the Go version it needs and the other modules it depends on.
- go mod tidy — The go subcommand that adds any module your code imports but go.mod lacks, and removes any it lists but no longer uses.
- generated client — Client code produced automatically from an API specification such as an OpenAPI document.
- baseline — A recorded picture of what normal looks like, used as the reference for spotting changes.
- autostart — Any location Windows checks to start programs automatically, such as Run keys, services, scheduled tasks and the Startup folder.
- lockfile — A file that records the exact version of every dependency, including transitive ones, so every install gets the same set.
- version control — A system, usually Git, that records every change to a set of files with who made it and why, so work can be reviewed and rolled back.
- terraform fmt — The command that rewrites .tf files into Terraform's one standard layout; it never looks at real infrastructure.
- terraform plan — The command that compares configuration, state and reality and prints the actions needed to make them match, without changing anything.
- assertion rewriting — pytest's trick of rewriting plain assert statements as it imports test files so failures print the values involved.
Taught in
- The Request And The Response — AI Engineering: LLM Apps, RAG & Agents
- Anatomy Of A Prompt — AI Engineering: LLM Apps, RAG & Agents
- Prompts As Code — AI Engineering: LLM Apps, RAG & Agents
- How RAG Works And When To Use It — AI Engineering: LLM Apps, RAG & Agents
- Chunking And Ingestion — AI Engineering: LLM Apps, RAG & Agents
- Grounded Answers With Citations — AI Engineering: LLM Apps, RAG & Agents
- Workflows Before Agents — AI Engineering: LLM Apps, RAG & Agents
- Threat-Model An LLM App — AI Engineering: LLM Apps, RAG & Agents
- Regression Tests In CI — AI Engineering: LLM Apps, RAG & Agents
- Working With AI Coding Assistants — AI Engineering: LLM Apps, RAG & Agents
- Check Mode And Diff — Ansible Configuration Management at Scale
- Securing Data With Ansible Vault — Ansible Configuration Management at Scale
- A Testing Strategy In The Pipeline — Microsoft Azure DevOps Engineer Expert (AZ-400) Exam Prep
- Pipelines, tee And Process Substitution — Bash Scripting & Command Line Automation
- Argo CD: Components, Applications And Projects — Certified Argo Project Associate (CAPA) Exam Prep
- Health, Reconciliation And Fields Argo CD Should Ignore — Certified Argo Project Associate (CAPA) Exam Prep
- Seven Steps Called GitOps: The Declarative Principle — Certified GitOps Associate (CGOA) Exam Prep
- Two Clicks Nobody Wrote Down: Configuration And Infrastructure As Code — Certified GitOps Associate (CGOA) Exam Prep
- Thursday, With A Way Back: Promotion, Deploy And Release — Certified GitOps Associate (CGOA) Exam Prep
- Three Teams, Three Formats: Manifests And Packaging — Certified GitOps Associate (CGOA) Exam Prep
- A Bucket Nobody Wrote Down: State Stores Beyond Git — Certified GitOps Associate (CGOA) Exam Prep
- Repository Layout for Environments — Continuous Integration & Continuous Delivery Pipelines
- Pre-Commit Secret Scanning with Gitleaks & Entropy — Cloud Security & DevSecOps Engineering
- Kubernetes NetworkPolicies & Microsegmentation — Cloud Security & DevSecOps Engineering
- Static IaC Scanning: Linting Terraform with Checkov — Cloud Security & DevSecOps Engineering
- Enforcing OPA Guardrails on Terraform Plan Payloads — Cloud Security & DevSecOps Engineering
- Defense-in-Depth & Security Control Categories — Cybersecurity Fundamentals, GRC & Cryptography
- Security Baselines, Policies & Hardening Standards — Cybersecurity Fundamentals, GRC & Cryptography
- Screen Reader Interactions: Live Regions & Announcement Cues — Design Systems & Component Engineering
- Visual Regression Testing: Playwright & Snapshot Differencing — Design Systems & Component Engineering
- Directory.Build.props, global.json and Central Packages — Modern .NET Core, C# & Enterprise Microservices
- Code Quality: .editorconfig and Roslyn Analyzers — Modern .NET Core, C# & Enterprise Microservices
- Comparing Controllers and Minimal APIs — Modern .NET Core, C# & Enterprise Microservices
- Why Version Control, And Why Git Won — Advanced Git Internals & Distributed Workflows
- What A Commit Really Is — Advanced Git Internals & Distributed Workflows
- The Three Areas: Working Tree, Index, Repository — Advanced Git Internals & Distributed Workflows
- Staging Deliberately: status, add, add --patch — Advanced Git Internals & Distributed Workflows
- Committing, And What A Good Message Says — Advanced Git Internals & Distributed Workflows
- Reading History: log, show And diff — Advanced Git Internals & Distributed Workflows
- HEAD, And Why Detached HEAD Is Not An Error — Advanced Git Internals & Distributed Workflows
- Merging: Fast Forward Or A Merge Commit — Advanced Git Internals & Distributed Workflows
- Rebase: The Same Work, A Different History — Advanced Git Internals & Distributed Workflows
- Undoing: restore, reset, revert And stash — Advanced Git Internals & Distributed Workflows
- Clone, Forks, Push, And The Upstream Branch — Advanced Git Internals & Distributed Workflows
- The Pull Request, And Branch Naming — Advanced Git Internals & Distributed Workflows
- Tags And Releases — Advanced Git Internals & Distributed Workflows
- The Workflow That Ran On A Stranger's Pull Request — GitHub Actions (GH-200) Exam Prep
- The Merge Request That Deployed To Production — GitLab Certified CI/CD Associate Exam Prep
- Continuous Integration, Delivery And Deployment: One Keyword Apart — GitLab Certified CI/CD Associate Exam Prep
- Rules, Workflow Rules And The Legacy only And except — GitLab Certified CI/CD Associate Exam Prep
- Parent, Child And Multi-Project Pipelines — GitLab Certified CI/CD Associate Exam Prep
- Artifacts: Which Files Reach Which Jobs — GitLab Certified CI/CD Associate Exam Prep
- Caching: Dependencies That Survive Between Pipelines — GitLab Certified CI/CD Associate Exam Prep
- Reading Security Results: The Merge Request And The Vulnerability Report — GitLab Certified CI/CD Associate Exam Prep
- Faster Pipelines: Minutes You Can Win Back — GitLab Certified CI/CD Associate Exam Prep
- Go Workspaces and Modules — Concurrent Systems Programming with Go
- Implementing An OpenAPI Contract — Modern Java: Virtual Threads & High-Throughput Services
- Two Versions Of The Truth: GitOps, Helm And Kustomize — Kubernetes and Cloud Native Associate (KCNA) Exam Prep
- Detecting Persistence: Tasks, Registry & Services — Security Operations & Threat Hunting (SOC)
- Secure Defaults — Application Security & Threat Modeling for Engineers
- Dependency Risk And Typosquatting — Application Security & Threat Modeling for Engineers
- Lockfiles And Reproducible Builds — Application Security & Threat Modeling for Engineers
- Static Application Security Testing — Application Security & Threat Modeling for Engineers
- Change Management Without Outages — CompTIA Security+ (SY0-801) Exam Prep
- What Is Infrastructure As Code? — Infrastructure as Code with Terraform
- Installing Terraform And Meeting The CLI — Infrastructure as Code with Terraform
- Writing Your First Configuration In HCL — Infrastructure as Code with Terraform
- The Terraform Registry And Public Modules — Infrastructure as Code with Terraform
- Running Terraform In CI — Infrastructure as Code with Terraform
- Arrange, Act, Assert — Automated Testing, TDD & Quality Engineering
- Making Failures Explain Themselves — Automated Testing, TDD & Quality Engineering
- What To Look For In A Review — Automated Testing, TDD & Quality Engineering
- Validate, Format, Destroy, And The Flags That Bend A Plan — HashiCorp Terraform Associate (004) Exam Prep
- One Edited File, Six Rebuilt Steps: Layers, Cache And Flat Images — Docker Certified Associate (DCA) Exam Prep
- Two Containers, How Much Disk? Storage Drivers, Layers And devicemapper — Docker Certified Associate (DCA) Exam Prep
- One Word Locked Out Every Directory User: PAM, SSSD, LDAP And Kerberos — CompTIA Linux+ (XK0-006) Exam Prep
- The Release Tag That Never Left The Laptop: Git Branches, Remotes, Tags And History — CompTIA Linux+ (XK0-006) Exam Prep
- Git For Admins: Who Changed That, And How To Undo It — Linux Foundation Certified System Administrator (LFCS) Exam Prep
- Anatomy Of A Playbook: Plays, Tasks And Modules — RHCE in Ansible (EX294): Automate Red Hat Systems
- Variables And Where They Win: group_vars, host_vars And Play Vars — RHCE in Ansible (EX294): Automate Red Hat Systems
References
- diff(1) manual page
- POSIX diff utility
- GNU Diffutils manual
- git-diff documentation
- Playwright: visual comparisons
- terraform fmt command
- Python docs: difflib
Certification courses
- AWS AIP-C01 course and practice exam: AI engineering with LLM apps, RAG and agents
- AZ-400 course and practice exam: Microsoft Azure DevOps Engineer Expert
- CAPA course and practice exam: Certified Argo Project Associate
- CGOA course and practice exam: Certified GitOps Associate
- GH-200 course and practice exam: GitHub Actions
- GitLab CI/CD Associate course and practice exam: GitLab Certified CI/CD Associate
- KCNA course and practice exam: Kubernetes and Cloud Native Associate
- CompTIA Security+ course and practice exam: SY0-801
- Terraform Associate course and practice exam: HashiCorp Terraform Associate (004)
- DCA course and practice exam: Docker Certified Associate
- CompTIA Linux+ course and practice exam: XK0-006
- LFCS course and practice exam: Linux Foundation Certified System Administrator
- RHCE course and practice exam: Red Hat Certified Engineer in Ansible (EX294)