# Comments (https://diffhub.blode.md/features/comments) Leave review notes on any line and copy them as a prompt for an agent or teammate. ## Adding comments Click any line in the diff to open the comment input. Type your note and press Enter to save it. ## Comment tags | Tag | Purpose | | -------------- | ------------------------------------ | | `[must-fix]` | Critical issue that must be resolved | | `[suggestion]` | Improvement suggestion | | `[nit]` | Minor style or formatting note | | `[question]` | Question about the code | ## Copy as prompt Click the copy button in the status bar to copy all comments as a formatted markdown prompt. This is useful when you want to hand review feedback to an agent or share it with a teammate. ## Storage Comments are stored in `.git/diffhub-comments.json` inside the target repository. The file is gitignored by default and stays there between sessions. # Diff Views (https://diffhub.blode.md/features/diff-views) See your whole branch against the base branch or switch to uncommitted-only changes. ## Split vs unified Toggle between split and unified views with the `s` key or the layout toggle in the status bar. - **Split** - side-by-side view with the old file on the left and the new file on the right - **Unified** - one stream of additions and deletions inline ## Diff modes DiffHub supports two review modes from the status bar: - **All** (default) - shows everything your branch changed since it diverged from the base branch. This is the mode most people want before push. - **Uncommitted** - shows only your staged and unstaged changes against `HEAD`. ## Merge-base diffing DiffHub diffs against `git merge-base HEAD `. That means commits pushed to the base branch after you branched do not show up in the review. You only see what your branch changed. # Introduction (https://diffhub.blode.md/) Review your branch in cmux or a browser. DiffHub is a local diff viewer for cmux. It opens your branch in a browser split and compares it with the detected base branch, usually `origin/main`. If you do not use cmux, you can open the same view in a normal browser window. [Watch the demo (2 min)](https://www.loom.com/share/e0203dd97b354508a791ecd339094a02) ## Quick start ```bash npx diffhub@latest cmux ``` That starts DiffHub and opens your branch diff in a cmux browser split. ```bash npx diffhub@latest ``` Use that if you want a normal browser tab instead. ### Global install ```bash npm install -g diffhub ``` ## What you get - **Branch diff against the right base branch**. DiffHub uses the merge-base, so you see what your branch changed. - **Split and unified views**. Toggle with `s`. - **Inline comments**. Tag notes as `[must-fix]`, `[suggestion]`, `[nit]`, or `[question]`. - **File sidebar**. Filter files with `/` and scan per-file `+` and `-` stats. - **Auto-refresh while you work**. Keep the view open and see updates as files change. - **Open in your tools**. Right-click to jump into Zed, VS Code, Terminal, or Finder. Requires Node.js 20.11 or later and a git repository with at least one commit. cmux mode expects `cmux.app` on macOS at `/Applications/cmux.app`. ## Next steps - [Usage](https://diffhub.blode.md/usage) - run DiffHub in cmux or a browser - [Diff Views](https://diffhub.blode.md/features/diff-views) - review your whole branch or only uncommitted changes - [Comments](https://diffhub.blode.md/features/comments) - leave review notes # Usage (https://diffhub.blode.md/usage) Run DiffHub in cmux or a browser and choose a base branch. ## cmux ```bash npx diffhub@latest cmux ``` Run that inside any git repository. DiffHub starts the local viewer and opens it in a cmux browser split. cmux mode currently expects `cmux.app` on macOS at `/Applications/cmux.app`. Use these flags when you need them: ```bash # Use a different base branch diffhub cmux --base develop # Point at a repo in another directory diffhub cmux --repo ~/projects/my-app ``` ## Browser ```bash npx diffhub@latest ``` That starts the same viewer in your default browser. ## Commands | Command | Description | | ------- | ---------------------------------------- | | `serve` | Start DiffHub in a normal browser window | | `cmux` | Start DiffHub in a cmux browser split | ## `serve` options | Flag | Default | Description | | --------------------- | ------- | --------------------------- | | `-p, --port ` | `2047` | Port to serve on | | `-r, --repo ` | `cwd` | Path to the git repository | | `-b, --base ` | auto | Base branch to diff against | | `--no-open` | — | Skip automatic browser open | ## `cmux` options | Flag | Default | Description | | --------------------- | ------- | --------------------------- | | `-r, --repo ` | `cwd` | Path to the git repository | | `-b, --base ` | auto | Base branch to diff against | ## Examples ```bash # Open in cmux diffhub cmux # Use a different base branch in cmux diffhub cmux --base develop # Point cmux mode at a repo in another directory diffhub cmux --repo ~/projects/my-app # Use a different port in browser mode diffhub --port 3000 # Don't open the browser automatically diffhub --no-open ``` ## Base branch detection DiffHub auto-detects the base branch in this priority order: 1. `origin/main` 2. `origin/master` 3. `origin/develop` 4. `origin/dev` 5. Local `main`, `master`, `develop`, `dev` Override with `--base ` or the `DIFFHUB_BASE` environment variable if your repo uses a different naming convention. ## Keyboard shortcuts | Key | Action | | ---------- | ------------------------------ | | `j` | Next file | | `k` | Previous file | | `s` | Toggle split / unified view | | `/` or `t` | Focus file filter | | `r` | Force refresh diff | | `c` | Collapse / expand current file | | `Shift+C` | Collapse all files | | `Shift+E` | Expand all files | ## Environment variables | Variable | Description | | ----------------------- | ----------------------------------------------- | | `DIFFHUB_REPO` | Path to the git repository (overrides cwd) | | `DIFFHUB_BASE` | Base branch override (overrides auto-detection) | | `DIFFHUB_DEBUG` | Set to `1` for verbose git command logging | | `DIFFHUB_DISABLE_WATCH` | Set to `1` to disable file system watching |