Home/Glossary/Text Diff (Difference)

Text Diff (Difference)

A comparison showing line-by-line or character-by-character changes between two versions of text.

DevelopmentAlso called: "file diff", "text comparison", "patch"

Diff tools highlight what changed between text versions for review and merging.

Diff formats

  • Unified diff: +/- lines with context (Git default).
  • Context diff: Before/after sections with ! markers.
  • Side-by-side: Two-column comparison.
  • Inline/word diff: Character-level changes within lines.

Common diff notation

  • Lines starting with - (removed).
  • Lines starting with + (added).
  • Lines starting with @ (chunk headers).
  • Unchanged lines for context.

Use cases

  • Code review in pull requests.
  • Document version comparison.
  • Configuration file changes.
  • Merge conflict resolution.
  • Backup verification.

Tools

  • Git diff, diff command (Unix).
  • IDE built-in comparison.
  • Online diff checkers.
  • Merge tools (Beyond Compare, Meld).

Advanced features

  • Ignore whitespace changes.
  • Word/character-level granularity.
  • Three-way merge (base, theirs, yours).
  • Syntax-aware diffing (for code).