Skip to main content
Choose the comparison inputs and output format independently. File and directory comparisons work without Git; repository modes use the installed Git executable.

Comparison modes

Use ./ or an absolute path if a filename could also be a Git ref. -- stops option parsing and permits literal paths such as -before.rs or a file named languages at the command boundary.

Options

Unknown flags and invalid formats are errors. Use -- before file paths that begin with a dash. Successful comparisons, including comparisons with changes, exit zero. Input, Git, parsing setup, and output errors exit nonzero; a closed output pipe is handled normally.

Subcommands

For a small comparison from the shell:
To write a report or inspect selected records:

Exit behavior

Successful comparisons exit zero whether or not edits exist. For unchanged standalone files, terminal output is no logical changes, JSON is [], and NDJSON has no records. Repository/range human reports use a context message such as nothing changed; machine envelopes remain valid. Parseable output is not replaced with a human sentence in a machine format. Errors return nonzero and write diagnostics to stderr. Unknown flags, invalid formats, unreadable inputs, incompatible file/directory pairs, and failed Git commands are errors. A closed output pipe is handled normally. The internal --git-diff-driver invocation accepts Git’s seven external-driver arguments; there is no legacy worker-process entry point to use in scripts.

Configuration

Differens searches the current directory and then its parents for differens.toml or .differensrc.json. In each directory it tries TOML first and uses the first valid configuration it finds. You can set the default format and the extensions registered by install-git-driver:
The equivalent .differensrc.json is:
Explicit format flags override the configuration. Format shortcuts such as --json take precedence over --format. Unreadable or malformed configuration files do not stop comparisons; unsupported setting values are ignored. The TOML loader also accepts the older unquoted format = markdown syntax. driverExtensions affects Git driver registration, not the parsers compiled into the binary. Run differens languages to check those parsers. Git driver mode is an internal invocation; applications should use the normal comparison commands.

Engine API

differens-engine supplies DiffEngine::new(jobs), DiffEngine::stream(inputs), the free function diff_inline(&FilePair), report_file, report, and load_config. It reuses a native thread pool, preserves result ordering, and composes parsing, narration, and cross-file correlation. Its worker windows limit in-flight files/source bytes; individual oversized files and retained correlation candidates still affect memory usage.

Write a complete changeset report

This example supplies an input pair directly, then uses the native engine’s ordered report path. It prints the resulting LLM report: