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) - Creates PRs and MRs directly via
gh(GitHub) orglab(GitLab) with--create - 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 pr --create Create the PR/MR after generating (requires gh or glab)
gitai pr --create --draft Create as a draft PR/MR
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.
Creating PRs directly
Add --create to push the generated description straight to GitHub or GitLab:
# Create a PR on GitHub (requires gh: https://cli.github.com)
gitai pr --create
# Create a draft MR on GitLab (requires glab: https://gitlab.com/gitlab-org/cli)
gitai pr --create --draft
gitai detects your provider automatically from the remote URL (github.com or gitlab.com). You'll be prompted to confirm before anything is created. Make sure you're logged in with gh auth login or glab auth login first.
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 - Create PRs/MRs directly via
gh/glabwith--create - 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.1.0.tar.gz.
File metadata
- Download URL: gitai_cli-1.1.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 |
74de13ac9d47bec581aa2ae0ac659c12671d90ff293357a5650ae90661e2dd4e
|
|
| MD5 |
baf78850aa74bfabfbe56a63ba5e2657
|
|
| BLAKE2b-256 |
6355f9b63d0b38ac25aa8b93de840ac4e7bf68df15d10be5d9aa397c63c0209f
|
File details
Details for the file gitai_cli-1.1.0-py3-none-any.whl.
File metadata
- Download URL: gitai_cli-1.1.0-py3-none-any.whl
- Upload date:
- Size: 12.2 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 |
cf4971471435d497a821acec9c465a977aeeee23f54a9e9c6702cde8fc838ae8
|
|
| MD5 |
38a17ce70e9bc9fcf55bdf8b8b11752e
|
|
| BLAKE2b-256 |
1af397739bcd1ca001aa67c2d9a79e1105b9043c04865b67726641f360c461e2
|