Diff
Definition
A diff shows differences between files, prepared changes, or saved versions.
A diff compares changes between two states. For text files, added and removed lines are often shown with context. Git can compare working directory, staging area, and commits; the chosen comparison determines the visible changes.
Simply explained
You see which parts have changed between two versions without having to read both completely.
Why it matters in practice
Targeted comparisons facilitate reviews and help detect unintended changes before acceptance.
Example from business
Possible example: Before a commit, a developer checks the diff of staged files and discovers an accidentally changed configuration value.
Limits and pitfalls
- A diff does not prove functionality. Incorrect comparison points, extensive formatting changes, or binary files can complicate content assessment.
Origin & history
Change comparisons are a basic tool of version control; they show differences, not automatically their technical significance.
Use in mid-sized companies
- Teams check the appropriate comparison and separate extensive formatting from functional changes as much as possible to keep reviews understandable.
Frequently asked questions
Does git diff show all changes?
Without additional options, usually only unstaged changes compared to the index; other comparisons require appropriate arguments.
Sources
- git-diff. · Git (o. J.): git-diff.
Editorially reviewed on: