Diff
- Standard term
A diff shows what changed between two versions of a project: which lines or files were added, removed, or edited.
A comparison: Like tracked changes in a shared document: every insertion and deletion is marked, and you still decide whether each one stays.
A diff tool lines up the two versions and works out a short list of lines removed from the old version and added in the new. It marks removed lines with a minus sign and added lines with a plus, keeps a few unchanged lines around each change, and shows an edited line as one removed and one added.
Where you’ll meet it
You ask your coding agent to change the price on your website's pricing page from $20 to $25. Its summary says it updated the price. The diff shows that line, plus a change in another file that turns off the receipt email sent after each purchase.
What to do
Keep the price change, and ask the agent why it touched the email file before you accept anything. If the reason has nothing to do with your request, have it undo that part, then ask it to place a test order and confirm the receipt still arrives.
Easy to mix up
| Diff | Commit |
|---|---|
| No, it's worked out on request, from any two versions | Yes, each one is a saved snapshot with a note |
Check yourself
Your coding agent worked all afternoon and saved its progress three times along the way. You want to review everything it changed. Which diff shows that?
Go deeperLine diffs misread some changes, and a saved one replays them elsewhere
A renamed file can show up as one file deleted and another added, a moved block as a deletion and an insertion, and an image as a bare note that it changed. Git, the program most projects use to track their versions, and the review sites built around it offer options for these, such as rename detection and word-level diffs.
A diff saved as a file is a “patch,” which anyone with a copy of the project can apply to reproduce the change. Many open-source projects took emailed patches long before sites such as GitHub offered pull requests, web pages for reviewing a proposed change. Coding agents often still write edits in a diff-like format, which the program running them applies.