AI agents: fetch the documentation index at llms.txt. Markdown versions are available by appending .md to any page URL, including this page's markdown.
Usage
Run the DiffHub git diff viewer in cmux or a browser and choose a base branch.
cmux
npx diffhub@latest cmuxRun 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:
# Use a different base branch
diffhub cmux --base develop
# Point at a repo in another directory
diffhub cmux --repo ~/projects/my-appBrowser
npx diffhub@latestThat 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 <port> | 2047 | Port to serve on |
-r, --repo <path> | cwd | Path to the git repository |
-b, --base <branch> | auto | Base branch to diff against |
--no-open | — | Skip automatic browser open |
cmux options
| Flag | Default | Description |
|---|---|---|
-r, --repo <path> | cwd | Path to the git repository |
-b, --base <branch> | auto | Base branch to diff against |
Examples
# 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-openBase branch detection
DiffHub auto-detects the base branch in this priority order:
origin/mainorigin/masterorigin/developorigin/dev- Local
main,master,develop,dev
Override with --base <branch> 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 |