Skip to main content

Git Integration

Differens plugs into your normal git diff workflow. Instead of line hunks, it reports the semantic changes: renames, moves, added parameters.

Install the driver

One command registers Differens as a git diff driver in your repo’s local config, then prints the .gitattributes lines you need to opt files in:
Add the diff=differens lines to .gitattributes (repo root or per-directory) for every extension you want covered. Files without the attribute keep normal git diff output. Now git diff on a .ts file shows the change instead of a hunk:
The driver receives both versions of every changed file, so this works in git diff, git diff --staged, and git difftool. To remove the driver later, unset the config. See the note in the git package reference.

Standalone modes

No git driver required. differens reads git directly.

Working tree

With no arguments, differens diffs the working tree against HEAD and correlates the changes across files:
This is git diff HEAD in semantic form. It picks up unstaged and staged changes. Untracked files are excluded.

Commit ranges

Diffs every file that changed between two refs. Output is grouped per file, with cross-file moves reported at the end:

Two commits

Both arguments resolve as git refs, so two SHAs or branch names diff like a range:

Two directories

If both arguments are directories, Differens walks each one and diffs matching relative paths:
Files present on only one side are whole-file additions or removals. Generated and vendor directories (node_modules, dist, .git, …) are skipped. Files over 2 MiB are treated as whole-file additions or removals.

How it compares to git diff