Git-surgeon gives AI agents surgical control without interactive prompts
Git-surgeon is a tool that enables AI agents to manage git changes without needing interactive prompts. It allows for precise control over commits, including staging, unstaging, and discarding individual hunks. This functionality helps avoid destructive workarounds that agents previously had to use when committing changes separately.
- ▪Git-surgeon allows AI agents to stage, unstage, or discard individual hunks of code.
- ▪The tool enables agents to commit hunks directly with line-range precision.
- ▪Git-surgeon can restructure commit history by splitting or folding commits.
Opening excerpt (first ~120 words) tap to expand
git-surgeon Install · Commands · Examples · Changelog git-surgeon gives AI agents surgical control over git changes without interactive prompts. Stage, unstage, or discard individual hunks. Commit hunks directly with line-range precision. Restructure history by splitting commits or folding fixes into earlier ones. Check out jj-hunk-tool if you're using Jujutsu. Why? AI agents can't use interactive git commands like git add -p. When asked to commit changes separately, they resort to destructive workarounds: ❯ commit the changes separately ⏺ Bash(git diff internal/bot/listing_handler.go) ⎿ diff --git i/internal/bot/listing_handler.go ... ... +83 lines ⏺ Let me reset and make the changes in two separate commits.
…
Excerpt limited to ~120 words for fair-use compliance. The full article is at GitHub.