Skip to main content

AI-powered git commit message generator

Project description

gitai

The Commit Genie

PyPI version Python versions MIT license

AI-powered git commit message generator. Analyzes your staged changes and suggests meaningful commit messages — using any LLM you already have access to.

Features

  • Reads your staged git diff and generates commit message suggestions (3 by default, configurable)
  • 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

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 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

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"

Local setup (Ollama)

If you want to run fully offline with Ollama:

  1. Install Ollama
  2. Pull a model: ollama pull llama3.2
  3. Run gitai commit — no API key needed

TODO

  • Allow configuring the number of suggestions generated
  • Support unstaged changes with an optional --all flag

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

gitai_cli-0.3.0.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gitai_cli-0.3.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file gitai_cli-0.3.0.tar.gz.

File metadata

  • Download URL: gitai_cli-0.3.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

Hashes for gitai_cli-0.3.0.tar.gz
Algorithm Hash digest
SHA256 0cb9549cecf018426f59d424f2b28a80d21aa2c23bc223ece33e460d941c4c83
MD5 01afe60486d347df1338245cf8839f97
BLAKE2b-256 6424f122bb177a166a936793aca374bedde55db64ce767be05b6b602bc580912

See more details on using hashes here.

File details

Details for the file gitai_cli-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: gitai_cli-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for gitai_cli-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fa5a8006e4e20500261aaef93e110238bd981709117e2a09309790e776fd76fe
MD5 c4686812a654ec4ff4b2a93e5fdbb9b9
BLAKE2b-256 c7a4d2900a9bc94b5785b85d550cb9f952ec62c218ab175cf39d0eb1eea6932a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page