git-hunk
Original:🇺🇸 English
Translated
Split uncommitted changes into focused, logical commits using git-hunk. Use when asked to "split changes", "split commits", "organize commits", "commit by hunk", or "separate changes into commits".
3installs
Sourcewkentaro/git-hunk
Added on
NPX Install
npx skill4agent add wkentaro/git-hunk git-hunkTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →/git-hunk - split changes into focused commits
Requires: (or )
uv tool install git-hunkpip install git-hunkWorkflow
- — see all hunks (file, id, +/- stats). No diffs.
git-hunk list - or
git-hunk show <id> [<id>...]when headers aren't clear enough.git-hunk show --all - Plan commits before staging. For each planned commit, list the hunk IDs (and line ranges for partial hunks). A single hunk may need to be split across commits. Ask the user if grouping is ambiguous.
-l - Stage and commit each group:
bash
git-hunk stage <id1> <id2> ... git commit -m "<type>: <description>" - again to check nothing got left behind.
git-hunk list
Partial hunks
Line selection () works with , , and (requires single id):
-lstageunstagediscard- Include lines:
git-hunk stage <id> -l 3,5-7 - Exclude lines:
git-hunk stage <id> -l ^3,^5-7
Fixing mistakes
- — move staged hunks back to working tree.
git-hunk unstage <id1> <id2> ... - — partially unstage specific lines.
git-hunk unstage <id> -l 3,5-7 - — permanently discard unstaged hunks (restore from HEAD).
git-hunk discard <id1> <id2> ... - — partially discard specific lines.
git-hunk discard <id> -l 3,5-7
Example git-hunk list
output
git-hunk listunstaged:
labelme/app.py
c43213b @@ -78,6 +78,7 @@ _AI_CREATE_MODES +1
4da0d77 @@ -1364,6 +1365,19 @@ class MainWindow +13
labelme/translate/de_DE.qm
7a3befc Binary fileNotes
- IDs are content-based hashes, stable across partial staging, and support prefix matching
- — filter hunks by file path
git-hunk list [<file>...] - /
--stagedto filter--unstagedandlist(both search staged+unstaged by default)show - exists but plain output is usually enough
--json - One logical change per commit, conventional commit messages