RunToolz iconRunToolz
Welcome to RunToolz!
DiffDebuggingDevelopment

Finding What Changed: A Guide to Text Diff

Spot differences between files, configs, and code versions without losing your mind.

RunToolz TeamJanuary 29, 20263 min read

Something broke. The config file looks the same. Except it isn't—somewhere in those 500 lines, one character changed.

Good luck finding it manually.

Diff tools exist for exactly this. Compare two versions, see what changed. Debugging time drops from hours to seconds.

When Diff Saves You

Configuration files. Deployment broke? Compare the working config to the current one.

Code reviews. What actually changed in this pull request?

API responses. Why does the same endpoint return different data now?

Document versions. What did the client change in the contract?

Ready to try it yourself?Compare Text

Reading Diff Output

Most diff tools show:

  • Removed lines in red (prefixed with -)
  • Added lines in green (prefixed with +)
  • Context lines unchanged, showing surrounding content
 function process(data) {
-  return data.toLowerCase();
+  return data.toLowerCase().trim();
 }

One line changed. The old version didn't trim, the new one does.

Side-by-Side vs Unified

Unified diff shows changes inline. Compact, good for small changes.

Side-by-side shows old and new versions next to each other. Better for understanding larger changes.

Pick based on what you're comparing.

Character-Level Diff

Line diff shows which lines changed. Character diff shows exactly what characters within those lines.

For debugging configuration, character-level helps find:

  • Extra spaces
  • Wrong quotes (' vs ")
  • Invisible characters
  • Case differences

Practical Tips

Strip whitespace when it doesn't matter. Trailing spaces and different line endings cause noise.

Ignore case when appropriate. Sometimes "TRUE" and "true" are the same.

Use context. Seeing surrounding lines helps understand changes.

Diff structured data carefully. JSON and XML should be formatted identically before comparing, or reformatting differences will mask real changes.

Common Use Cases

Debugging environment differences. Compare staging config to production. The difference is usually the bug.

Tracking changes over time. Save versions before and after changes. Diff tells you exactly what you did.

Validating migrations. Compare database dumps before and after. Unexpected differences mean migration bugs.

Code review. See what's actually changing, not what the author claims changed.

When Line Diff Isn't Enough

Binary files. Diff tools work on text. Images, PDFs, and executables need specialized tools.

Semantically identical but differently formatted. Two JSON files with the same data but different formatting will show many differences. Normalize first.

Moved code. Standard diff shows deletion and addition separately. Advanced tools can detect moves.


Diff is an underrated debugging tool. When something "looks the same" but behaves differently, stop guessing and compare. The difference is there—you just need to see it.