Skip to content
noihPublic

About

Review and tweak your Git changes side by side, in the terminal.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

33 Commits

Folders and files

Repository files navigation

difv — side-by-side git diff in the terminal

crates.io downloads license

Review and tweak your Git changes side by side, in the terminal. A TUI diff viewer for git diff output that is also an editor, so a code review and the fixes it turns up happen in the same window.

Three panes: your changed files, HEAD, and the working tree. The working-tree pane is an editor — fix the small things while you review, save, move on. Its right edge is a ruler of the whole file, so every change is on screen even when the lines are not. Built to be used while the files are still moving under it: another editor, a formatter, a rebase.

┌ Changes (4) ────────┬ HEAD / Before ──────────┬ Working Tree / Current ─────┐
│ M src/auth.ts       │ 1 const timeout = 3000  │ 1 const timeout = 5000      │
│ D src/old.ts        │ 2 oldCall()             │ 2 newCall()                 │
│ M src/user.ts       │                         │ 3 anotherLine()             │
│ A src/utils.ts      │ 3 return user           │ 4 return user               │
└─────────────────────┴─────────────────────────┴─────────────────────────────┘
 [settings ,] [help ?]                                             1-4/4

Install

brew install noih/tap/difv

Or, with a Rust toolchain (1.88+):

cargo install difv

Apple Silicon macOS and Linux. git has to be on your PATH.

Use

Run difv inside a Git repository and it shows what git diff HEAD would, with an editor on the right. The arguments are git diff's too, so there is nothing new to learn:

difv                 # HEAD against the working tree
difv main            # a revision against the working tree
difv 3d8cab3^!       # what one commit changed
difv main..feature   # one revision against another

Anything git accepts as a revision works, because git is what resolves it. A revision on the right is read-only; the working tree is not.

The Commits pane under the file list is that same history. Enter compares the commit under the cursor, in whatever form the command line asked for: after difv main it stays against the working tree, after difv <rev>^! it stays one commit's own changes, after difv main..feature it keeps main as the base. The Working tree row at the top is the way back.

difv -C <path> points it at a repository you are not standing in, the way git -C does. A directory only says which repository — the list is the whole repository's changes either way — and a file says which repository and which file to open on.

  • Click, scroll, or arrow around; drag a border to resize; drag to select and Ctrl+C to copy from either side; right-click a file to copy its path. The right pane is editable: focus it and type. Ctrl+S saves, Ctrl+Z undoes, Esc gets you back to the file list.
  • ? shows every key. , opens the settings, which are also plain TOML in ~/.config/difv/config.toml with every option explained.

Release

Keep the developer checkouts side by side: difv/ and homebrew-tap/. The sibling tap must be the root of a clean main checkout of noih/homebrew-tap, with HEAD matching GitHub. Run scripts/release X.Y.Z from a clean, synced difv main; it keeps the existing bump, checks, push, crate publication, and release workflow sequence.

The script copies the published formula into the sibling developer checkout, runs brew style on that file when Homebrew is available, and commits it locally. Run the printed push command to git@github.com:noih/homebrew-tap.git yourself. The script leaves Homebrew's managed tap alone. After the tap push lands, update the installed tap with brew update, then run brew readall --os=all --arch=all noih/tap and brew audit --strict --online noih/tap/difv against that installed copy.

Release-script regression checks: python3 tests/release_script.py (isolated fake commands; no publication or real tap writes).

Links

License

MIT

About

Review and tweak your Git changes side by side, in the terminal.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Contributors

Languages