# Hunk vs git diff

> Hunk vs git diff. git diff prints a unified patch. Hunk renders the same data as a navigable review UI with a file sidebar, split view, and agent notes. What changes, and what does not.

Source: https://hunk.dev/compare/hunk-vs-git-diff/ · Last checked: 2026-09-01

`git diff` prints a unified patch to standard output. One long stream, one file after another, with no navigation past your pager's search. Hunk reads the same data and draws a review UI: one multi-file stream, a file sidebar, split or stacked layouts, syntax highlighting, mouse support, expandable context, watch mode, and agent annotations on hunks. Git still computes the diff. Hunk replaces the reading. Run `hunk diff` where you would run `git diff`, or point `core.pager` at `hunk pager`.

## Choose Hunk if

- The changeset spans more than a couple of files and scrolling stopped working as navigation.
- You want side-by-side, syntax highlighting, and a file list without configuring anything.
- You want more context around one hunk without re-running the command with `-U`.
- An agent wrote the change and you want its reasoning beside the code.

## Choose git diff if

- You are scripting, piping, or generating a patch to apply somewhere else.
- You want the exact bytes Git produces, with no renderer in between.
- You are on a machine where installing anything is not an option.
- The change is two lines and you already know what they are.

## What `git diff` gives you

`git diff` is not a bad tool. It is a precise one aimed at a different job. It computes a changeset and writes a unified patch to standard output, and that output is the interchange format of the whole ecosystem. `git apply` consumes it, review systems parse it, and every diff viewer including Hunk is ultimately rendering it.

It does not try to be a reading interface. No syntax highlighting, no side-by-side, no file list, no sense of where you are. Once a changeset gets past a few files your only navigation is your pager's search, and the usual workaround is re-running the command with narrower paths until the output fits on a screen.

## What Hunk changes

Hunk runs Git underneath and renders the result as a UI. Every visible file becomes one continuous review stream and the sidebar indexes it, so selecting a file jumps you there without hiding the rest of the change. `[` and `]` move hunk by hunk across the changeset, `,` and `.` move file by file, and `z` expands unchanged context without re-running anything.

Layout, line numbers, wrapping, and theme all change while you read. The mouse works: click a file, use the wheel or scrollbar, open menus. `hunk diff` also includes untracked files, which `git diff` leaves out and which is a routine source of confusion about files you know you wrote.

The rest is agents. When one produced the change, it can attach reasoning to specific hunks via `hunk session`, and Hunk renders those notes inline beside the code instead of in a chat window you read separately.

Three ways to reach it:

```bash
curl -fsSL https://hunk.dev/install.sh | sh

# 1. directly, where you would have typed git diff
hunk diff
hunk show HEAD~1

# 2. as an opt-in Git alias
git config --global alias.hdiff '-c core.pager="hunk pager" diff'
git hdiff

# 3. from any patch at all
git diff --no-color | hunk patch -
```

## What stays the same

Git is still the source of truth. Hunk does not reimplement diffing, does not change what counts as a change, and does not modify your files or Git state. It reads what Git reports and draws it. Rename detection, `--color-moved`, and path filtering all still come from Git, and `hunk show HEAD~1 -- src/ui README.md` filters the way you would expect.

It also takes nothing away. `git diff` keeps working, scripts that parse it keep working, and an alias gives you Hunk only when you want it, without changing your default pager.

## Hunk vs git diff, capability by capability

git diff is written in C and licensed GPL-2.0. Hunk is TypeScript, MIT, and ships as a standalone binary for macOS, Linux, and Windows.

| Capability | Hunk | git diff |
| --- | --- | --- |
| Produces the diff — Hunk runs Git underneath. Git is still the thing that computes the changeset. | No | Yes |
| Output usable as a patch — `git diff` is what you pipe into `git apply`. Hunk is a viewer. | No | Yes |
| Syntax highlighting | Yes | No |
| Side-by-side / split view — `git diff` has no split view. `git difftool` shells out to another program for one. | Yes | No |
| Themes — Hunk ships 65 bundled themes and takes custom ones. Git has `color.diff.*` settings rather than themes. | Yes | Partly |
| Word-level highlighting inside a changed line — Git has `--word-diff` and `--color-words`, opt-in per invocation. Hunk highlights word-level changes by default. | Yes | Partly |
| File sidebar you can jump from | Yes | No |
| Hunk-by-hunk navigation across the changeset | Yes | No |
| Mouse: click, wheel, scrollbar, menus | Yes | No |
| Change layout, wrapping, and theme mid-review | Yes | No |
| Expand unchanged context in place — In Git, more context means re-running with a larger `-U`. | Yes | No |
| Shows untracked files in the review — `hunk diff` pulls untracked files into the changeset. `git diff` omits them. | Yes | No |
| Watch mode that reloads the review | Yes | No |
| Inline agent and human annotations on a hunk | Yes | No |
| Moved-line detection — Both use Git's `--color-moved`. Hunk honors `diff.colorMoved` from your Git config. | Yes | Yes |
| Scriptable, pipeable output — Hunk is interactive. `hunk session review --json` is its machine-readable surface, aimed at agents rather than shell pipelines. | Partly | Yes |
| Available everywhere with no install | No | Yes |
| Native Jujutsu and Sapling support | Yes | No |

## Questions people ask

### Does Hunk replace git diff?

No. Hunk runs Git underneath and renders its output. `git diff` works exactly as before, and it is still the right tool for scripting, piping, and generating patches to apply.

### How do I get a side-by-side git diff in the terminal?

`git diff` has no side-by-side mode. Run `hunk diff` instead, where split view is the default on wide terminals, or configure a difftool. Press `1` for split, `2` for stack, and `0` for the responsive layout at any point.

### Can I make `git diff` itself open Hunk?

Yes. Set `core.pager` to `hunk pager` and patch-like output opens in the review UI, while everything else falls through to your plain-text pager. To keep your current pager, add an alias instead: `git config --global alias.hdiff '-c core.pager="hunk pager" diff'`.

### Why does `hunk diff` show files that `git diff` does not?

It includes untracked files by default, which is usually what you want when reviewing your own work in progress. Pass `--exclude-untracked` to match Git's behavior.

### What about GNU diff, the one that is not part of Git?

GNU `diff` compares two files or directories outside version control. The closest Hunk equivalent is `hunk diff --files before.ts after.ts`, which opens the same review UI on a pair of files and can watch both for changes.

## Sources

- [git-diff, Git documentation](https://git-scm.com/docs/git-diff)
- [Hunk: working trees and commits](https://hunk.dev/docs/workflows/working-trees-and-commits/)
- [Hunk: Git pager and difftool](https://hunk.dev/docs/workflows/git-pager-and-difftool/)

## Other comparisons

- [Hunk vs delta](https://hunk.dev/compare/hunk-vs-delta/) — delta restyles the text Git already printed. Hunk turns the same changeset into a review UI. Most people keep both.
- [Hunk vs difftastic](https://hunk.dev/compare/hunk-vs-difftastic/) — difftastic changes what the diff says. Hunk changes how you read the changeset. Different problems, both worth solving.
- [Hunk vs diff-so-fancy](https://hunk.dev/compare/hunk-vs-diff-so-fancy/) — diff-so-fancy tidies Git's diff output. Hunk replaces the reading experience. The gap is bigger than it looks.
- [Hunk vs Plannotator](https://hunk.dev/compare/hunk-vs-plannotator/) — Both exist because agents write more code than you can read. Plannotator reviews it in the browser and covers plans. Hunk stays in the terminal.
