git-hunk
git-hunk is a small Rust CLI for non-interactive hunk staging.
It lets you scan diffs, inspect exact changes, stage or unstage precise selections, and preview commits without using git add -p.
Install
From crates.io:
From GitHub:
Binary installer:
|
Commands
scanlists selectable hunks and changes and returns asnapshot_idshowprints a hunk,change_id, orchange_keyresolvemaps a file and line hint to matching selectorsvalidatechecks whether selectors still match the current snapshotstagestages selected hunks, changes, change keys, or line rangesunstageremoves selected hunks, changes, change keys, or line ranges from the indexcommitstages a selection and commits it, or previews it with--dry-run
Example
Notes
- Mutating commands require a fresh
snapshot_id change_idis snapshot-bound;change_keyis more stable across rescans- Unsupported paths like conflicts, renames, and binary diffs are reported instead of forced through
Build
Release
On every push to main, GitHub Actions runs tests, publishes a new crates.io version when Cargo.toml has an unpublished version, and creates a matching GitHub release with binary archives.