# git-rewrite-commits

A CLI tool that rewrites an entire git commit history into better, conventional-format messages using a local Ollama model or a remote AI provider.

git-rewrite-commits automatically rewrites a repository's commit history into conventional-commit-style messages using AI, useful for cleaning up a messy history before open-sourcing a project or merging a feature branch. It supports local processing through Ollama, so no data leaves the machine, or remote providers such as OpenAI, in which case it requires explicit consent before sending file lists and diffs and automatically redacts API keys, passwords and private keys from what it sends.

Because rewriting history changes commit hashes and needs a force push, the project documents when not to use it, such as on shared branches or after others have pulled the commits, and it always creates a backup before rewriting. It can also run as an opt-in git hook that generates an AI commit message automatically on every commit, and supports generating messages in multiple languages. It is written in TypeScript under the MIT license.

Website: https://blog.fka.dev/git-rewrite-commits/
