Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changeset/long-queens-boil.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ Hunk auto-detects Jujutsu and Sapling checkouts, so `hunk diff [revset]` and `hu
hunk diff before.ts after.ts # compare two files directly
hunk diff before.ts after.ts --watch # auto-reload when either file changes
git diff --no-color | hunk patch - # review a patch from stdin
gh pr diff 123 --patch | hunk patch - # review a GitHub PR without checking it out
```

Watch mode remains continuous. Direct-file and Git-backed reviews normally use filesystem observation to refresh promptly, with periodic polling retained as a fallback for missed events or unavailable watchers. Jujutsu and Sapling reviews currently use polling rather than filesystem observation.
Expand Down
23 changes: 23 additions & 0 deletions website/src/content/docs/docs/workflows/files-and-patches.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,26 @@ 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](/docs/workflows/git-pager-and-difftool/), where Hunk can fall back to plain text.

## Review a GitHub pull request

Because patch mode accepts any unified diff on stdin, you can review a pull request without checking it out by piping the [GitHub CLI](https://cli.github.com):

```bash
gh pr diff 123 --patch | hunk patch -
```

If you review pull requests often, wrap it in a small shell function in your `.bashrc`/`.zshrc`:

```bash
hunk-pr() {
gh pr diff "$1" --patch "${@:2}" | hunk patch -
}
```

```bash
hunk-pr 123
hunk-pr 123 --repo owner/repo
```

The same pattern works for any forge tool that can emit a unified diff, such as `glab mr diff` for GitLab.