diff
A fundamental concept in version control that presents differences between two versions in a unified format, using `-` for deleted lines, `+` for added lines and `@@` to mark change locations. It can compress context and focus review.
Core Facts
Timeline (last 90 days)
To obtain a meaningful view of changes, it is usually necessary to first parse legal text into a structured format (such as XML or JSON) and then compare differences at the structural level, rather than directly running diff on plain text.
Traditional code review tools only show the diff, hiding a great deal of context (such as the behavior of called functions, module dependencies, and historical conventions) when facing an unfamiliar repository, which is insufficient to support reading through an entire codebase.
To avoid unexpected sweeping changes by AI, explicitly constrain the scope of changes in the prompt (such as "only change this function, don't touch other files") and review the diff line by line before committing.
If a commit mixes formatting, renaming, and logic changes, the noise in the diff increases, and the targeting of question generation is affected.
For Sphinx, the diff is the most critical input for generating quiz questions, defining the scope of the current change.
Sphinx generates targeted questions around the diff content of the current commit.
The Skill does not treat the diff as the scope of activity, but instead asks the reviewer to start from the changes and look for improvement opportunities across the entire codebase.
By stripping outputs and metadata, passing only code-cell diffs, and replacing overly long lines with length+hash, the token consumption per notebook review can be cut from about 30k to 1k–1.6k, a reduction of over 95%.
In the notebook scenario, diff granularity typically falls at the cell level (since cells can be arbitrarily added, deleted, reordered, and modified), and then line-level diff is performed on the source lines within a cell.
For an LLM, a diff not only saves tokens but also constrains the model's attention to the current changes, avoiding the large amount of unchanged logic in the full code diluting the review focus.
12 more timeline events
All Facts (20)
A pull request (PR) is a core mechanism of modern software collaboration, in which a developer completes work on an independent branch and then submits a merge request to the main codebase, which is merged after code review.
75%UnverifiedUnix系统中的diff工具由Douglas McIlroy在1974年开发,其核心算法是最长公共子序列(LCS)
85%UnverifiedTo obtain a meaningful view of changes, it is usually necessary to first parse legal text into a structured format (such as XML or JSON) and then compare differences at the structural level, rather than directly running diff on plain text.
50%UnverifiedTraditional code review tools only show the diff, hiding a great deal of context (such as the behavior of called functions, module dependencies, and historical conventions) when facing an unfamiliar repository, which is insufficient to support reading through an entire codebase.
50%UnverifiedTo avoid unexpected sweeping changes by AI, explicitly constrain the scope of changes in the prompt (such as "only change this function, don't touch other files") and review the diff line by line before committing.
50%UnverifiedIf a commit mixes formatting, renaming, and logic changes, the noise in the diff increases, and the targeting of question generation is affected.
50%UnverifiedSphinx generates targeted questions around the diff content of the current commit.
50%UnverifiedFor Sphinx, the diff is the most critical input for generating quiz questions, defining the scope of the current change.
50%UnverifiedThe Skill does not treat the diff as the scope of activity, but instead asks the reviewer to start from the changes and look for improvement opportunities across the entire codebase.
50%UnverifiedThe diff strategy applies only to iterative review workflows; when first getting a model to understand the entire project structure, a certain amount of full context is still required, and diff does not apply.
50%UnverifiedBy stripping outputs and metadata, passing only code-cell diffs, and replacing overly long lines with length+hash, the token consumption per notebook review can be cut from about 30k to 1k–1.6k, a reduction of over 95%.
50%UnverifiedIn the notebook scenario, diff granularity typically falls at the cell level (since cells can be arbitrarily added, deleted, reordered, and modified), and then line-level diff is performed on the source lines within a cell.
50%UnverifiedFor an LLM, a diff not only saves tokens but also constrains the model's attention to the current changes, avoiding the large amount of unchanged logic in the full code diluting the review focus.
50%UnverifiedA diff refers to the set of added and removed lines in a commit or a PR relative to the baseline version; reviewers actually read the diff rather than the complete files.
50%UnverifiedBinary or rich-format files such as PDF, Word, and Excel are opaque byte streams, and diff tools cannot perform meaningful line-by-line comparisons on them.
50%UnverifiedDiff comparison is a core function of version control tools, comparing two text files line by line and highlighting added, deleted, or modified parts.
50%UnverifiedA unified diff is produced by the diff -u command, with each file block annotated with the original and target paths using --- a/ and +++ b/.
50%UnverifiedA diff is a standard format used in software development to display the specific changes between two versions of a file, typically with deleted lines marked in red and added lines marked in green
50%UnverifiedClassic command-line tools such as grep, sed, awk, and diff all process text streams as their target and can be combined in series via pipes.
50%UnverifiedBy reviewing the overall diff, the judge can catch ID-heuristic issues that break adjacent assertions, identifying associative damage invisible to single-point unit tests.
50%