I'm tired of scrolling long diff patch files.
A fast, minimal terminal UI for interactively selecting hunks from a unified diff and writing out a filtered patch.
This tool allows you to curate large patches into smaller, reviewable, or cherry-pickable subsets with immediate visual feedback.
Built with Rust, powered by ratatui and crossterm.
- Parse standard unified diffs (
git diff,git format-patch, etc.) - Interactive TUI hunk browser
- Live preview with colored additions/removals
- Toggle hunks on/off and auto-save the filtered patch
- Preserves original file headers and metadata
- Fully keyboard-driven
- Lightweight and dependency-minimal
- Load a patch file
- Navigate between hunks
- Toggle only the changes you want
- Instantly produce a clean filtered patch for:
- Partial code reviews
- Stacked diffs
- Backports
- Cherry-picking across branches
cargo install --git https://github.com/vimkim/patchers.git patchersgit clone https://github.com/yourname/patchers.git
cd patchers
cargo install --path .git clone https://github.com/yourname/patchers.git
cd patchers
cargo build --releaseBinary will be available at:
target/release/patcherspatchers <INPUT_PATCH> --output <OUTPUT_PATCH>git diff > diff.patch
patchers diff.patch -o filtered.patchWhile running:
| Key | Action |
|---|---|
↑ / k |
Move up |
↓ / j |
Move down |
Space / Enter |
Toggle hunk & save |
q |
Quit |
Each toggle immediately writes the output file, so your filtered patch is always up to date.
-
Expects a standard unified diff
-
Fully compatible with:
git diffgit showgit format-patch
-
Handles:
- Multi-file patches
- Arbitrary metadata sections
\ No newline at end of file
-
Writes a valid unified diff
-
Preserves:
diff --githeadersindex,---,+++lines
-
Includes only selected hunks
-
Safe to apply with:
git apply filtered.patch- Left panel: Hunk list with file labels and previews
- Right panel: Colored diff preview
- Bottom panel: Status & key bindings
[x]indicates selected hunks[ ]indicates unselected hunks
- Graceful parsing of malformed diffs
- Live status feedback on save errors
- Clean terminal teardown on panic or exit
- Preparing minimal review patches
- Splitting large diffs into logical commits
- Creating safe hotfix patches
- Extracting specific features from large changes
- Teaching and demonstration of patch mechanics
cargo run -- diff.patch -o filtered.patchFormatting:
cargo fmtLinting:
cargo clippyMIT License. You are free to use, modify, and distribute this tool.
Pull requests are welcome. Please follow standard Rust formatting and keep commits focused.
Suggested areas for improvement:
- File-level toggling
- Search / filter hunks
- Unified scroll for large hunks
- Mouse support
- Git integration mode
ratatuifor the TUI frameworkcrosstermfor cross-platform terminal control- Git’s unified diff format