the9ball/.dotfiles/git-stage-lines
Claude Code and agent skill by the9ball/.dotfiles
- community
Checking that the SKILL.md file is still in the repository.
Safely stage only selected working-tree Git changes by line range or diff hunk, without changing the working tree or discarding existing staged changes. Use for requests such as `この変更だけstageして`, `42〜57行目だけgit addして`, `変更1と3だけstageして`, `commit A用の変更だけstageして`, or `git add -p相当を非対話的にやって`.
Install
npx vskill@latest install the9ball/.dotfiles/git-stage-linesSKILL.md
The same SKILL.md was published earlier as the9ball/.dotfiles/git-stage-lines.
Git Stage Lines
Use bin/git-stage-lines.mjs with Node.js 20 or newer. It creates and checks a patch, then applies it only to the index.
Procedure
- Inspect
git status --short,git diff -- <path>, and
git diff --cached -- <path>.
- For change numbers, run
--list -- <path>, retain the fingerprint printed
to stderr, and pass it with --fingerprint. --changes requires the exact fingerprint from the preceding --list.
- Run
--dry-runbefore applying when the list shows an unexpected deletion
count, a replacement hunk, or another non-obvious selection.
- Apply the selection, then verify
git diff --cached -- <path>and the
remaining unstaged diff. A mismatch is failure.
Examples:
node "$HOME/.agents/skills/git-stage-lines/bin/git-stage-lines.mjs" --list -- src/foo.ts node "$HOME/.agents/skills/git-stage-lines/bin/git-stage-lines.mjs" -- src/foo.ts 42-57 node "$HOME/.agents/skills/git-stage-lines/bin/git-stage-lines.mjs" --dry-run -- src/foo.ts 42-57 node "$HOME/.agents/skills/git-stage-lines/bin/git-stage-lines.mjs" --changes 1,3 --fingerprint HASH -- src/foo.ts
Use the --changes example for deletion-only hunks; it is their only selection path.
Rules
- Preserve existing staged changes and never rewrite the working tree.
- Put the path after
--; do not pass an ambiguous request or infer nearby changes. - Select complete text hunks only.
Luses new-side lines andDuses old-side lines. Deletion-only hunks (no added lines) require--changes. Replacement hunks can be selected by a line range containing all their new-side changed lines, or by--changes; both sides, for exampleL20/D20-80 (+1/-61), are staged as one unit. If a line range also overlaps a deletion-only hunk's old-side coordinates, use--changesto select the intended hunks explicitly. - Normalize overlapping or adjacent line ranges by merging them; do not add lines outside their union.
- Reject unsupported renames, copies, binary files, symlinks, submodules,
mode-only changes, conflicts, malformed hunks, and failed verification.
- Exit codes:
0success,1internal error,2fix the request,3unsupported target/runtime,4safety check failure or changed state,5Git failure.
Implementation: bin/git-stage-lines.mjs. Tests: tests/git-stage-lines.test.mjs.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckinglink-targets/agents/skills/git-stage-lines/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/the9ball/.dotfiles/git-stage-lines)