mirror of
https://github.com/f/git-rewrite-commits.git
synced 2026-04-27 06:35:49 +03:00
[PR #24] feat: add commit splitting feature for cleaner git history #25
Labels
No labels
bug
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/git-rewrite-commits#25
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/f/git-rewrite-commits/pull/24
State: open
Merged: No
feat: add commit splitting feature for cleaner git history
Summary
This PR adds a new
--splitoption that allows users to split large commits into smaller, more focused commits for cleaner git history and easier rollbacks.The feature uses AI to analyze commit diffs and suggest logical splits based on:
Key additions:
--splitflag to enable commit splitting mode--max-splitsoption to limit splits per commit (default: 5)Review & Testing Checklist for Human
Test the
performCommitSplitmethod with real commits - This method performs destructive git operations (git reset --soft,git checkout,git cherry-pick). Verify the error recovery works if something fails mid-split.Test non-HEAD commit splitting - The cherry-pick logic for commits after the split target could fail with merge conflicts. Verify the warning message is appropriate and the repo isn't left in a broken state.
Verify AI JSON parsing - The code expects specific JSON structure from the AI. Test with both OpenAI and Ollama to ensure responses parse correctly. Edge cases: malformed JSON, missing fields, markdown-wrapped responses.
Test with special characters in filenames - The
git add "${file}"command may have issues with unusual filenames.Recommended test plan:
npx git-rewrite-commits --split --dry-runto previewnpx git-rewrite-commits --spliton a feature branchgit log --onelineto confirm splits look correctNotes
Link to Devin run: https://app.devin.ai/sessions/cdf71c5996d741918aff6b5f70f2bf62
Requested by: Fatih Kadir Akın (fatihkadirakin@gmail.com) / @f