git-hunks

Stage specific Git hunks by stable ID for atomic commits.

1|Updated Jun 1, 2025
One-click install
npx skills add https://github.com/rcdailey/dotfiles --skill git-hunks
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-hunks
Source: https://github.com/rcdailey/dotfiles/tree/main/home/dot_config/opencode/exact_skills/git-hunks
Command: npx skills add https://github.com/rcdailey/dotfiles --skill git-hunks

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Use when staging individual hunks or partial changes within a file non-interactively (scripted replacement for git add -p). This enables splitting a file's changes across multiple commits, staging only selected lines or regions, or selecting hunks in automated workflows where terminal interaction is unavailable.

Core Features & Use Cases

  • Stage specific hunks by ID to craft precise commits
  • List unstaged hunks with stable IDs for easy reference
  • Hunk IDs follow the pattern file:@-old,len+new,len and remain stable during staging
  • Workflow example: view hunks, stage chosen ones, and commit

Quick Start

List available hunks with git hunks list, then add the desired hunks by ID using git hunks add '<id>' and commit.

Frequently Asked Questions about git-hunks

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I stage specific hunks non-interactively in a Git working tree?

To stage specific hunks non-interactively, list unstaged hunks with their stable IDs, then add the desired hunks by ID to create focused, atomic commits without terminal prompts.

Can I split a file's changes across multiple commits using partial staging?

Yes, partial staging by hunk allows splitting a file's changes across multiple commits. You select specific line regions using stable hunk IDs, stage them individually, and commit separately.

What is the hunk ID format used for staging partial Git changes?

The hunk ID format follows the pattern file:@-old,len+new,len. These IDs remain stable during staging, ensuring reliable reference when selecting hunks for automated workflows.

Is there a scripted replacement for git add -p in automated workflows?

Yes, this provides a scripted replacement for git add -p. It enables selecting hunks in automated workflows where terminal interaction is unavailable by listing and staging hunks by ID.

How do I list and add unstaged hunks to craft precise Git commits?

Run git hunks list to view available unstaged hunks with stable IDs, then execute git hunks add '<id>' to stage chosen hunks and commit them for precise, atomic results.

When do I need to stage individual hunks instead of whole files in Git?

Stage individual hunks when you need to separate unrelated changes within the same file, create focused atomic commits, or automate partial staging in non-interactive environments.