6 min read
|
Saved February 14, 2026
|
Copied!
Do you care about this?
This tool automates the rewriting of git commit messages to follow conventional formats, making it easier to clean up commit histories. It's useful for personal projects before public release or cleaning up feature branches, but should be avoided on shared branches without team agreement.
If you do, here's more
The article introduces a tool called "git-rewrite-commits," which uses AI to improve git commit messages. It rewrites the entire commit history, making messages more structured and following the conventional commit format. This can be especially useful for developers looking to clean up a messy commit history before sharing projects or enhancing repository maintenance. However, it warns against using this tool on shared repositories without team coordination, as rewriting history alters commit hashes and requires force-pushing, which can disrupt workflows.
Key features include AI-powered commit message generation using models from OpenAI or local processing with Ollama. The tool supports multi-language message generation and smart filtering to skip already well-formed commits. Users can set up git hooks for automatic message generation during commits, preview messages before committing, and even specify project-specific guidelines through a `COMMIT_MESSAGE.md` file. The setup allows for both remote and local options, emphasizing privacy with automatic data redaction and requiring explicit consent before sending any data to remote servers.
Installation is straightforward, using the command `npx git-rewrite-commits` or its shorter alias `npx grec`. Users can configure various settings, such as commit templates, language preferences, and specific AI models for generating messages. The article details common use cases, like rewriting history, generating messages for staged changes, and previewing changes before applying them. Overall, the tool aims to enhance commit quality while maintaining security and user control.
Questions about this article
No questions yet.