mantish/ help / docs
Join the waitlist

What you can compare

Two files, two directories, the working tree, one commit or a range — and what each one means.

Last updated

text
mantish diff <A> <B>                     two files, or two directories
mantish diff [-C DIR]                    the working tree, against HEAD
mantish diff [-C DIR] <REV>              one commit, against its parent
mantish diff [-C DIR] <BASE>...<HEAD>    a range, with merge-base semantics

Mantish decides the mode from the arguments: two paths that are both files, or both directories (mixing them is an error); otherwise you are comparing the repository you are standing in.

Two files

sh
mantish diff Order.cs Order.new.cs
mantish diff /dev/null Order.cs          # shown as an addition
mantish diff Order.cs /dev/null          # shown as a deletion
mantish diff before.txt after.txt --name src/Order.cs

A is the before side, B the after side. /dev/null (nul on Windows) as either side turns the comparison into an addition or a deletion.

--name sets the display path, which is also how the engine picks the language. You need it when the files on disk have uninformative names — which is exactly what git difftool passes as $MERGED.

Two byte-identical files print no differences and open nothing.

Two directories

sh
mantish diff old/ new/

Files are paired by their path relative to each root, and the two trees are unioned: a file only in old/ is a deletion, only in new/ an addition, in both and different a modification. Byte-identical pairs are dropped, .git is skipped, symlinked files are followed and symlinked directories are not.

There is no rename detection in directory mode — pairing is by path only, so a renamed file reads as one deletion and one addition.

The working tree

sh
mantish diff
mantish diff -C ../other-project

The working tree of the repository containing the current directory (or -C DIR), against HEAD. It includes untracked files — the same listing the local review uses, so .gitignore is honoured. With an unborn HEAD (a repository with no commits yet) the before side is empty.

This is not git's index-vs-working-tree comparison; --staged is not supported yet, so staged and unstaged edits to a file both show up here.

One commit

sh
mantish diff HEAD~1
mantish diff 4b418f0b
mantish diff feature/login

That commit against its first parent. A root commit — one with no parent — is compared against the empty tree, so everything it introduced shows as added. A revision the repository does not have fails immediately, before anything opens.

A range

sh
mantish diff main...feature
mantish diff main..feature       # accepted, and means exactly the same

A range always uses merge-base semantics: what a pull request from feature into main would show, not a straight tree diff. Both spellings mean that; the two-dot form is accepted because people type it out of habit, and the output metadata always states comparison: merge-base so a script cannot mistake it for something else.

A true git diff A..B tree diff is not available.

Limitations, on purpose

  • No --staged / index comparison.
  • No git pathspecs (mantish diff -- src/); compare directories instead.
  • No rename detection in directory mode.
  • File mode changes are not reported — a mode-only change reads as a file with no text difference.
Was this page helpful?