Local-first AI Git assistant for Conventional Commits, changelogs, and PR descriptions.
CommitAI turns staged git diffs into clean Conventional Commit messages, concise changelog entries, and practical PR descriptions. It runs entirely on your machine with Ollama and Gemma 4, making it a fast, private, offline-friendly Git assistant built for real developer workflows.
Go to Demo Folder and download the mp4 file...
CommitAI can auto-generate commits from staged diffs, support a git commit hook workflow, and keep CHANGELOG.md updated without relying on any external API.
- AI-generated Conventional Commit messages
- Automatic changelog generation
- PR description generation
- Git hook integration
- Fully local using Ollama
- Gemma 4 powered
- Rich terminal UI
- No external APIs
- Offline-first workflow
Writing commit messages is one of those tasks every developer does constantly and usually does at the end of a session when context is already fading. The result is the same repetiti 8F56 ve workflow: inspect the diff, decide on a commit type, summarize the change, then repeat it again for changelog notes or a pull request description.
CommitAI removes that friction. It uses the staged diff as context, drafts the message for you, and keeps the whole workflow local. That means you get a faster loop without cloud dependency, external API keys, or source code leaving your machine.
Git Diff
↓
CommitAI
↓
Ollama API
↓
Gemma 4
↓
AI-generated commit/changelog
↓
Git commit execution
The flow is intentionally small: CommitAI reads staged changes, sends a focused prompt to Ollama, normalizes the model output into a Conventional Commit format, writes the changelog entry, and then completes the git workflow.
git clone https://github.com/Yuvakunaal/CommitAI.git
cd CommitAI
python3 -m pip install -r requirements.txtInstall and start Ollama if needed:
ollama serve
ollama pull gemma4:e2bSet up the git hook:
chmod +x hooks/prepare-commit-msg
cp hooks/prepare-commit-msg .git/hooks/prepare-commit-msgBasic commit flow:
python commitai.pyRuns the full local workflow: reads the staged diff, generates a commit message, updates the changelog, and commits the result.
Skip the confirmation prompt:
python commitai.py --no-confirmUseful when you already trust the generated message and want a faster path to the final commit.
Generate a PR description:
python commitai.py --prPrints a concise pull request description based on the staged diff instead of creating a commit.
Use a different Ollama model:
python commitai.py --model llama3This is handy if you want to compare models or switch to another local model.
Commit directly with git once the hook is installed:
git commitThe hook triggers CommitAI during prepare-commit-msg, so the generated message becomes part of the same commit flow.
CommitAI includes a prepare-commit-msg hook for automatic commit message generation.
- Make the hook executable:
chmod +x hooks/prepare-commit-msg- Copy it into Git's hook directory:
cp hooks/prepare-commit-msg .git/hooks/prepare-commit-msg- Commit normally:
git commitThe hook uses COMMITAI_HOOK=1 so CommitAI writes the generated message into Git's commit message file instead of recursively invoking another commit.
CommitAI uses gemma4:e2b because it is a strong fit for a lightweight local workflow. It is small enough to run comfortably on an 8 GB MacBook Air, fast enough for developer feedback loops, and capable enough to summarize staged diffs into useful commit messages and changelog entries.
That matters here because the task is not open-ended chat. It is structured reasoning over a git diff. Gemma 4 handles that well while keeping inference local, private, and dependable for everyday use.
- Lightweight local model
- Fast enough for commit workflows
- Well suited to low-memory systems
- Strong enough for diff summarization
- Privacy-friendly local inference
|
CLI output |
- Semantic release notes
- Multi-model support
- VS Code extension
- Diff summarization
- Team changelog modes
- Python
- Ollama
- Gemma 4
- Rich
- Git hooks
Contributions are welcome. Keep changes focused, readable, and local-first. If you're proposing a new feature, prefer simple implementations that preserve the current developer workflow instead of adding unnecessary abstraction.
- Fork the repository
- Create a branch for your change
- Test the workflow locally
- Open a pull request with a clear description
MIT