Skip to content

Repository files navigation

Review your git branch in a cmux browser split, with inline comments you can hand to an agent

Run one command inside any git repository and DiffHub serves a GitHub-style diff of your working tree at localhost:2047.

Demo

Browse any public GitHub pull request in the hosted viewer, with nothing installed.

View the demo

DiffHub reviewing a branch

Install

npm install -g diffhub

Or run it without installing: npx diffhub@latest.

Quickstart

Run inside any git repository.

# Review the current branch in a cmux browser split
diffhub cmux
# The same viewer in your default browser
diffhub
# Compare against a different base branch
diffhub cmux --base develop
# Review a repository in another directory
diffhub cmux --repo ~/Code/mblode/cmux

The default view is touched: HEAD versus the working tree, including untracked files. Merge-base scopes (all, committed) are available from the status bar, and --base still selects the comparison branch, preferring origin/main so unpushed commits show up. A watcher marks updates available; press r to refresh. diffhub cmux uses a repo-derived port in 20000–29999 instead of 2047.

Commands

CommandDescription
diffhubOpen DiffHub in your default browser
diffhub cmuxOpen DiffHub in a cmux browser split
diffhub serveSame as diffhub, starts the local web app

Options

diffhub and diffhub serve

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

diffhub cmux

FlagDefaultDescription
-r, --repo <path>cwdPath to the git repository
-b, --base <branch>autoBase branch to diff against

Keyboard shortcuts

KeyAction
j / kNext / previous file
sToggle split / stacked view
cCollapse or expand the selected file
Shift+CCollapse all files
Shift+EExpand all files
/ or tFocus the file filter
rRefresh the diff
F2Toggle the Diff stats panel

Notes

  • Node.js 20.11+ or Bun 1.0.23+, and a git repository (git rev-parse --show-toplevel must succeed).
  • cmux mode expects cmux.app installed on macOS at /Applications/cmux.app.
  • Comments live in .git/diffhub-comments.json in the repository you are reviewing, and copy out as a markdown review prompt for a coding agent.

License

MIT


Crafted by Matthew Blode

About

Local git diff viewer

Topics

Resources

Stars

20 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages