git-hunk
git-hunk is a small Rust CLI for non-interactive hunk staging.
It is meant for AI agents and other tooling that need an agent-safe replacement for git add -p so they can make atomic commits from Bash.
Install
Install from crates.io after the first publish:
Install directly from GitHub at any time:
After the first GitHub release exists, install the latest binary with:
|
Install a specific version:
| GIT_HUNK_VERSION=0.1.0
The installer currently supports:
- macOS
aarch64 - macOS
x86_64 - Linux
x86_64
Commands
scanlists selectable hunks and change blocks and returns asnapshot_idshowprints a hunk or change with line numbersstagestages selected hunks, changes, or line rangesunstageremoves selected hunks, changes, or line ranges from the indexcommitstages a selection and commits it in one step
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.
Example
Notes
- Mutating commands require a fresh
snapshot_id - Rescan after every successful
stage,unstage, orcommit - Unsupported paths like conflicts, renames, and binary diffs are reported instead of forced through
See SKILL.md for the agent workflow and selector syntax.