From gah
Use when staging partial file changes, splitting commits, or excluding hunks - non-interactive alternative to `git add -p` for AI agents that cannot use interactive prompts
How this skill is triggered — by the user, by Claude, or both
Slash command
/gah:gahThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Stage specific hunks non-interactively. Use instead of `git add -p` which requires interactive input.
Stage specific hunks non-interactively. Use instead of git add -p which requires interactive input.
gah preview first.--dry-run for destructive or uncertain operations — Verify before committing.--split)--lines)1. gah preview <file> → See hunks with anchors
2. Identify target hunks → Note anchors (not indices)
3. gah add <file> -a <anchor> → Stage by anchor
4. git commit → Commit staged changes
5. Repeat for remaining → Anchors of unstaged hunks unchanged
gah preview <file> # See all hunks with indices and anchors
gah preview --all # All modified files
# By anchor (PREFERRED — stable across staging operations)
gah add <file> --anchor Apparent
gah add <file> -a App # prefix match works
# By index (fragile — indices shift after staging)
gah add <file> --hunks 1,3,5
gah add <file> --hunks 1-3
# By content pattern
gah add <file> --grep "pattern"
gah add <file> --grep "debug|console" --invert # exclude matches
# By line range — stages ONLY the changed lines in the range, trimming
# the hunk to those lines (NOT the whole overlapping hunk)
gah add <file> --lines 100-150
gah add <file> --lines 142 # one line out of a multi-line edit
# Combine filters
gah add <file> --grep "feature" --lines 50-200
# Verify first
gah add <file> -a Foo --dry-run
Git lumps nearby changes into one hunk. --split re-diffs at zero context so
each change is its own hunk — preview them, then stage independently.
gah preview <file> --split # finest-grained hunks + anchors
gah add <file> --split -a <anchor> # stage one split-out change
Splitting strategy:
--split to separate changes git merged into one hunk (gap ≥ 1 line).--lines to stage individual lines when changes are adjacent —
git (and --split) cannot break an adjacent replacement block apart, but
--lines trims it to the exact lines you name.gah preview --split first to see the resolved hunks and anchors.| Error | Cause | Fix |
|---|---|---|
| "not a git repository" | Not in git repo | cd to repo root |
| "No changes to stage" | File has no unstaged changes | Check git status |
| "hunk N does not exist" | Index out of range | Re-run gah preview |
| "No hunks match pattern" | Grep found nothing | Try different pattern |
| "Ambiguous anchor prefix" | Multiple anchors match | Use longer prefix |
Scenario: src/auth.rs has both a bugfix and debug logging.
$ gah preview src/auth.rs
[1:ValidateToken] @@ -45,7 +45,9 @@ fn validate_token(
context line
+ added line
- removed line
[2:DebugPrint] @@ -80,5 +82,10 @@ fn authenticate(
context line
+ println!("debug: token = {:?}", token);
src/auth.rs: 2 hunks
# Stage only the bugfix
$ gah add src/auth.rs -a ValidateToken
Staged 1 hunk (3 additions, 1 deletion)
$ git commit -m "fix: validate token expiry correctly"
# Debug logging still unstaged for separate commit or removal
Guides collaborative design exploration before implementation: explores context, asks clarifying questions, proposes approaches, and writes a design doc for user approval.
Creates structured, bite-sized implementation plans from specs or requirements before writing code. Useful for breaking down multi-step tasks into testable steps with file structure and task boundaries.
Resolves in-progress git merge or rebase conflicts by analyzing history, understanding intent, and preserving both changes where possible. Runs automated checks after resolution.
npx claudepluginhub thatxliner/gah --plugin gah