AI-powered git commit message generator
Project description
gitai
AI-powered git workflow tool. Generates meaningful commit messages and pull request descriptions from your diffs — using any LLM you already have access to.
Features
- Reads your staged
git diffand generates commit message suggestions (3 by default, configurable) - Generates PR titles and descriptions from your branch's commits (
gitai pr) - Interactive selection: pick a suggestion or write your own
- Supports multiple providers: Ollama (local), OpenAI, Anthropic, Gemini, and more
- Two commit styles: Conventional Commits or free-form
- Optional emoji (gitmoji) support
- Automatically truncates large diffs to fit model context limits
Installation
pip install gitai
Requires Python 3.11+.
Quick start
# 1. Stage your changes
git add .
# 2. Run gitai
gitai commit
gitai reads the diff, calls your configured LLM, and presents 3 suggestions to choose from.
Usage
gitai commit Generate commit message suggestions for staged changes
gitai commit --push Push to remote automatically after committing
gitai commit -n 5 Generate 5 suggestions instead of the default 3
gitai commit --suggestions 5 Same as above
gitai pr Push branch and generate a PR title + description
gitai pr development Compare against a specific base branch
gitai pr --full-diff Use a flat diff instead of per-commit breakdown
gitai pr --minimal Output title + bullet list only
gitai pr --template TEMPLATE Fill in a custom PR template file
gitai config View and update settings
gitai --version Show version
gitai --help Show help
Configuration
Run gitai config to update settings interactively. Settings are stored in ~/.gitai.toml.
| Key | Default | Description |
|---|---|---|
provider |
ollama |
LLM provider |
model |
llama3.2 |
Model name |
ollama_url |
http://localhost:11434 |
Ollama API base URL (Ollama only) |
commit_style |
conventional |
conventional or free-form |
emoji |
false |
Prefix suggestions with gitmoji |
num_suggestions |
3 |
Number of suggestions to generate |
max_diff_chars |
12000 |
Max diff size sent to the model (truncates if exceeded) |
Supported providers
| Provider | provider value |
Example model value |
API key env var |
|---|---|---|---|
| Ollama (local) | ollama |
llama3.2, mistral |
— |
| Anthropic | anthropic |
claude-sonnet-4-6, claude-haiku-4-5-20251001 |
ANTHROPIC_API_KEY |
| OpenAI | openai |
gpt-4o, gpt-4o-mini |
OPENAI_API_KEY |
| Gemini | gemini |
gemini-2.0-flash |
GEMINI_API_KEY |
For cloud providers, set the API key in your shell profile:
bash/zsh (~/.bashrc or ~/.zshrc):
export ANTHROPIC_API_KEY=sk-ant-...
PowerShell ($PROFILE):
$env:ANTHROPIC_API_KEY="sk-ant-..."
Example ~/.gitai.toml
provider = "anthropic"
model = "claude-haiku-4-5-20251001"
commit_style = "conventional"
emoji = false
ollama_url = "http://localhost:11434"
Generating PR descriptions
gitai pr pushes your current branch and generates a ready-to-copy PR title and description based on your commits.
# Auto-detect base branch (main/master/develop) and generate PR description
gitai pr
# Compare against a specific base branch
gitai pr development
# Use a flat diff instead of per-commit breakdown (good for large PRs)
gitai pr --full-diff
# Minimal output: title + bullet list only
gitai pr --minimal
# Fill in your team's PR template
gitai pr --template .github/PULL_REQUEST_TEMPLATE.md
If a .github/PULL_REQUEST_TEMPLATE.md exists in your repo, gitai will use it automatically.
Local setup (Ollama)
If you want to run fully offline with Ollama:
- Install Ollama
- Pull a model:
ollama pull llama3.2 - Run
gitai commit— no API key needed
TODO
- Allow configuring the number of suggestions generated
- Add
gitai prcommand for PR description generation - Support unstaged changes with an optional
--allflag
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gitai_cli-1.0.0.tar.gz.
File metadata
- Download URL: gitai_cli-1.0.0.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af49028303857dc45d0bb7f4ef95924873aad7d57242a09c5b79f563950c08a4
|
|
| MD5 |
bc33389ddfc52f748895f14f1b5c4e9d
|
|
| BLAKE2b-256 |
3c5c16f2a08d4c6173f24c943697b6eba201dfb7a5061f0efc6f9155499c9237
|
File details
Details for the file gitai_cli-1.0.0-py3-none-any.whl.
File metadata
- Download URL: gitai_cli-1.0.0-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
458befc94a61524f50341bee618f2d62dc1f2674a9364e261dbfaf703f349133
|
|
| MD5 |
e6cf2f0a18d7e8aa4623ad8d60294a7f
|
|
| BLAKE2b-256 |
c2038136a64811af74c059690693af79f8c8dfa4c3ca94fef9fff04ee0db9aa1
|