/git-stage-hunk:git-stage-hunk [--list [--file PATH] [--split] [--table]] [--hunk H1,H3.1,H5:5-10] [--pattern REGEX] [--file PATH] [--range FILE:S-E] [--verify] [--dry-run] [--table]from git-stage-hunk
Stages specific diff hunks from the working tree for selective commits. Lists hunks with IDs and stages by hunk ID, file, regex pattern, or line range. Replaces git add -p in non-interactive environments.
Ships in git-stage-hunk. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Non-interactive hunk staging for selective git add without a TTY. Replaces git add -p in scripted and multi-agent environments. Use when only some changes in a file belong in the current commit, when multiple sessions or agents modified the same file and you need to commit selectively, or when git add -p is unavailable because there is no TTY.
The heavy lifting happens in the Python script. Your first action MUST be Bash - call the script directly, then present the output. Do not re-implement git diff/apply logic yourself.
<skill-dir> in every command below is the absolute path of this skill's directory (the one holding this SKILL.md). In Claude Code it is ${CLAUDE_SKILL_DIR}. Run the commands from the root of the user's repository and call the script by that absolute path, keeping the double quotes: the script stages changes in the repository of the current working directory, so never cd into the skill directory.
"<skill-dir>/scripts/git-stage-hunk.py" --list --table
Before taking any action, read references/workflow.md completely. It is the authoritative procedure and preserves every platform fallback, decision rule, template, command, validation step, and output contract. Follow its sections in order and load the deeper references it names only at their stated gates.
Paths in the workflow are relative to this skill directory. When a named tool, agent, or interaction primitive is unavailable, use the workflow's compatibility fallback; never silently skip the behavior.
Invocation arguments: $ARGUMENTS
These are the mode and flags the user gave on invocation. The workflow reads them from here, not from its own text. If the line above is empty or still shows the literal placeholder, the client passed none: take the same values from the user's request.
agents/openai.yaml (opens in a new tab)references/output-format.md (opens in a new tab)references/patchutils-guide.md (opens in a new tab)references/split-hunk-guide.md (opens in a new tab)references/workflow.md (opens in a new tab)scripts/git-stage-hunk.py (opens in a new tab)scripts/ruff.toml (opens in a new tab)scripts/split_hunk.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
npx claudepluginhub smykla-skalski/sai --plugin git-stage-hunk