hunk-staging
Installation
SKILL.md
Hunk staging
Use this only when whole-path staging would mix independently reviewable changes.
- Inspect a nonempty index with
git diff --cached; preserve user-staged content unless the user requests otherwise. - For an untracked file, run
git add -N -- <path>so its hunks become selectable. - Run
git hunks list, then stage quoted IDs withgit hunks add '<id>'.... - Stage any complete files with
git add -- <paths>. - Verify the complete staged result with
git diff --cached. - Run
commit savewithout paths. Paths would reset the index and discard the partial selection.
Hunk IDs remain stable while other hunks are staged, but not after editing the worktree. A failed multi-hunk add may stage earlier requested hunks, so always perform the final verification.