π€ AI Summary
A new open-source CLI, git-rewrite-commits, uses OpenAI GPT models to automatically rewrite messy git histories into conventional, human-readable commit messages. You can run it via npx or install it globally, install git hooks with a single command (npx git-rewrite-commits --install-hooks), and either auto-improve each commit (post-commit), run pre-push cleanups, or rewrite batches (--max-commits). The tool reads diffs and original messages, scores message quality (conventional format, length, descriptiveness, tense, punctuation β default threshold 7/10) and uses the chosen GPT model (gpt-3.5-turbo by default, gpt-4/gpt-4o supported) to generate replacements that follow conventional-commit types, custom templates, languages, or fully custom prompts. It supports dry-run, backup branch creation, progress output, staged-change messaging, and CI dry-run checks.
For AI/ML and engineering teams this reduces friction when preparing repos for open-sourcing, code review, or enforcing commit standards, saving manual cleanup and onboarding time. Major caveats: rewriting history changes commit hashes and requires force-pushing (use --force-with-lease), so donβt run on shared/main branches without coordination. It also requires an OpenAI API key, meaning commit diffs are sent to a remote model β consider data sensitivity before use. Technically it uses git filter-branch to reapply messages and provides recovery via backup branches and dry-run previews, making it a practical but potentially disruptive automation for commit hygiene.
Loading comments...
login to comment
loading comments...
no comments yet