Skip to content
DiffHub

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 DiffHub in cmux or a browser and choose a base branch.

Usage

cmux

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:

# Use a different base branch
diffhub cmux --base develop

# Point at a repo in another directory
diffhub cmux --repo ~/projects/my-app

Browser

npx diffhub@latest

That starts the same viewer in your default browser.

Commands

CommandDescription
serveStart DiffHub in a normal browser window
cmuxStart DiffHub in a cmux browser split

serve options

FlagDefaultDescription
-p, --port <port>2047Port to serve on
-r, --repo <path>cwdPath to the git repository
-b, --base <branch>autoBase branch to diff against
--no-openSkip automatic browser open

cmux options

FlagDefaultDescription
-r, --repo <path>cwdPath to the git repository
-b, --base <branch>autoBase 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-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 <branch> or the DIFFHUB_BASE environment variable if your repo uses a different naming convention.

Keyboard shortcuts

KeyAction
jNext file
kPrevious file
sToggle split / unified view
/ or tFocus file filter
rForce refresh diff
cCollapse / expand current file
Shift+CCollapse all files
Shift+EExpand all files

Environment variables

VariableDescription
DIFFHUB_REPOPath to the git repository (overrides cwd)
DIFFHUB_BASEBase branch override (overrides auto-detection)
DIFFHUB_DEBUGSet to 1 for verbose git command logging
DIFFHUB_DISABLE_WATCHSet to 1 to disable file system watching