What problem does it solve?
git-hunk removes the friction of selecting partial changes by letting you inspect and stage precise diff hunks non-interactively, which is especially useful for AI agents and automated workflows.
Core Features & Use Cases
- Atomic staging & commit previews: Stage or commit exactly selected hunks/changes with
--dry-run previews to reduce mistakes.
- Agent-safe selectors: Prefer stable
change_key selectors over snapshot-bound change_id, with validate to recover when snapshots go stale.
- Resolve file+line hints: Use
resolve to map a file and line range to the recommended selectors, then apply them via stage, unstage, or commit.
Quick Start
Tell the AI: "Run git-hunk scan --mode stage --json, then git-hunk resolve --mode stage --snapshot <snapshot-id> --path <file> --start <line> --end <line> and finally git-hunk stage --snapshot <snapshot-id> --change-key <change-key>."