Stage specific code hunks using git hunks for selective commit preparation
name prepare-commit-changes description Stage specific code hunks using git hunks for selective commit preparation Prepare Commit Changes What I do List all unstaged and staged hunks with their unique IDs Present hunks to the user for selection Stage only the hunks the user explicitly selects When to use this Use this when the user asks to stage changes to git. Hunk ID Format file:@-old,len+new,len
$ git hunks list --staged A. src/config.c:@-5,2+5,3
Select hunks to stage (e.g., "1,3" or "1-2" or "all"): 1,3
$ git hunks add 'src/main.c:@-10,6+10,7' 'tests/api.test.js:@-50,10+50,12' Staged: src/main.c:@-10,6+10,7, tests/api.test.js:@-50,10+50,12 Stage from already staged hunks: $ git hunks list --staged
Select hunks to stage (or press Enter to skip): 1
$ git hunks add 'src/auth.c:@-100,5+100,6' Staged: src/auth.c:@-100,5+100,6