Skip to content

Files and patches

Use file comparison when you already have before and after content, and patch mode when another tool emits unified diff text.

Terminal window
hunk diff before.ts after.ts

When both operands are existing concrete files, Hunk treats them as a direct comparison instead of VCS targets. Add --watch to reload when either file changes:

Terminal window
hunk diff before.ts after.ts --watch
Terminal window
hunk patch changes.patch

A file-backed patch can use watch mode. It remains tied to that file path.

Terminal window
git diff --no-color | hunk patch -

Use - to make stdin explicit. Stdin is a snapshot, so it cannot use --watch; write the patch to a file when you need continuous reloads.

Patch-like input is parsed into the same file and hunk model as repository input. Non-diff text belongs in pager mode, where Hunk can fall back to plain text.