Skip to content

Repository files navigation

yadiff, yet another diff viewer

screenshot

Huge shoutout to pierrecomputer. Inspired by diffshub, this tool is only possible thanks to the incredibly beautiful and high-performance diff and tree packages. All credit goes to the team!

A browser diff viewer for local git/jj diffs and GitHub PRs. It uses pierrecomputer's open-source packages:

Usage

Run directly with npx:

npx @baggiiiie/yadiff
npx @baggiiiie/yadiff <git-ref-or-range>/<jj-revset>/<github-pr-url>
npx @baggiiiie/yadiff --working/--staged/--dirty

Or install globally:

npm install -g @baggiiiie/yadiff
yadiff HEAD

The command starts a local server in the background, opens the browser, acquires a diff from the selected source, and serves the patch to the browser. With no target, it defaults to --working (jj @ in a jj workspace, otherwise git diff). The shell command exits after launch. When there are no browser sessions for one minute, the local server exits automatically.

Use --foreground to keep the server attached to the current terminal.

Examples:

Git:

npx @baggiiiie/yadiff
npx @baggiiiie/yadiff HEAD
npx @baggiiiie/yadiff main..feature
npx @baggiiiie/yadiff main...HEAD --repo ../some-repo
npx @baggiiiie/yadiff --working/--staged/--dirty

jj:

npx @baggiiiie/yadiff @ --repo ../some-jj-repo
npx @baggiiiie/yadiff 'mine() & mutable()' --vcs jj

GitHub:

npx @baggiiiie/yadiff https://github.com/oven-sh/bun/pull/30412

Passing bun test:

yadiff.mp4

potential future improvement

  • add a button to sync review to github, with gh cli?
  • copy filename
  • support for private repo and enterprise, with gh cli
  • stdin support

License

MIT.

About

yadiff, yet another diff viewer, built on pierre's trees and diffs

Resources

Stars

14 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages