Skip to main content
Create two TypeScript files to see how Differens reports a rename and body edits. Install the CLI before running the examples.

Create two files

Save this as before.ts:
Save this as after.ts:

Compare them

From a source checkout, use cargo run -p differens -- before.ts after.ts. The native CLI prints:
The rename appears on its own line. Body and parameter edits are grouped under the function that contains them. Removals use the old name; additions use the new name. The unchanged TAX_RATE declaration produces no output. Terminal and Markdown reports group related edits for reading. JSON keeps the individual actions, so its action count can be larger than the displayed summary.

Read the underlying actions

Each array entry has an action, a description, and a filePath. The action contains its type (Insert, Delete, Update, or Move), node metadata, and nearest-first context. To inspect the rename without printing its full tree:
For a compact report with source lines, use --format=llm:
See machine outputs for schemas, streaming records, and source-coordinate conventions.

Compare a repository or directories

Inside a Git repository, running differens without arguments compares the working tree against HEAD, including staged, unstaged, and untracked files.
To compare two directory snapshots:
Repository and directory comparisons can detect moves across files. Exact moves need matching content; modified declaration moves must keep the same name and meet the similarity threshold. A move combined with a rename or major rewrite may remain an addition and a removal. See the CLI reference for options and configuration, or Git integration to use Differens through git diff.

See the same edit in a working tree

If the original function is committed in src/checkout.ts and you make the edit above, run differens from the repository root. The report groups the edits and adds a changeset summary:
To compare committed work, use differens main..feature or differens HEAD~1 HEAD. Direct file comparisons do not need a Git repository.

Follow a move between directories

A directory comparison uses matching relative paths, then checks additions and removals for cross-file moves. For example, moving an unchanged formatPrice between two existing files produces:
The cross-file walkthrough includes every file needed to reproduce this example and then edits the moved function to show a modified move.