Gitai is an AI-powered CLI tool that helps you write better git commit messages and review code, faster. It analyzes your changes (diffs) to generate concise, standardized commits that follow best practices, and can review your code for potential issues before you commit.
It supports three main workflows:
- Interactive Mode: A terminal UI (TUI) to visually select files, add context hints, and review/edit suggestions.
- Targeted Mode: A quick CLI command to generate messages for specific files or directories instantly.
- Review Mode: AI-powered code review that analyzes your changes and reports potential issues.
Below is a quick animated demo of gitai running in a terminal:
The project supports multiple AI backends (OpenAI, Google Gemini via genai, and local models via Ollama) and is intended to be used as a developer helper (interactive CLI, pre-commit hooks, CI helpers).
- AI-generated commit message suggestions based on repo diffs
- Interactive TUI to select files and review suggestions 🖱️
- Edit & Regenerate: Tweak suggestions in-place or regenerate them with a keystroke 🔄
- Security scanning: Automatically detects sensitive data (keys, passwords) in diffs before sending to AI 🔒
- Smart ticket extraction: Automatically parses Jira and GitHub issue URLs from hints to format commit headers 🎫
- Smart release detection: Automatically identifies version bumps in files like
VERSION,package.json,go.mod,Cargo.toml, etc., and formats them aschore(release)commits 🚀 - Conventional Commits: Generates messages following the Conventional Commits specification by default 📝
- Pluggable AI backends: OpenAI, Anthropic (Claude), Google Gemini, Groq, DeepSeek, XAI (Grok), Ollama (local)
- Zero external dependencies: Built in pure Go (no
gitbinary required) ⚙️
- Go 1.20+ (Go modules are used; CONTRIBUTING recommends Go 1.24+ for development)
- One of the supported AI providers (optional):
- OpenAI API key (
OPENAI_API_KEY) - Anthropic API key (
ANTHROPIC_API_KEY) - Google Gemini API key (
GEMINI_API_KEYorGOOGLE_API_KEY) - Groq API key (
GROQ_API_KEY) (uses OpenAI compatible client) - DeepSeek API key (
DEEPSEEK_API_KEY) (uses OpenAI compatible client) - XAI (Grok) API key (
XAI_API_KEY) (uses OpenAI compatible client) - Ollama binary available and
OLLAMA_API_PATHset (for local models) - Gemini CLI installed (for
geminicliprovider)
- OpenAI API key (
You can install gitai using Homebrew:
brew tap artback/gitai
brew install gitai- Clone the repository and build:
git clone https://github.com/artback/gitai.git
cd gitai
make build- Install (recommended)
make installThe make install target builds the gitai binary and moves it to /usr/local/bin/ (may prompt for sudo). Alternatively copy ./bin/gitai to a directory in your PATH.
Run the command without arguments to start the interactive TUI flow:
gitai suggest- Select files: Choose changed files from the list.
- Add hints: Optionally provide context (e.g., ticket URL or "fixes login bug").
- Review: The AI generates a message. You can Edit (
e), Regenerate (r), or Commit (c).
Automatically split changes in selected files into multiple atomic commits based on context.
gitai suggest --atomic- Review Plan: Gitai proposes a sequence of atomic commits.
- Reorder: Use
J(Shift+Down) /K(Shift+Up) to reorder commits if needed. - Edit: Press
eto edit any commit message. - Confirm: Press
cto apply and commit them sequentially.
Skip the file selector by passing specific files or directories directly:
gitai suggest internal/main.go README.md
# or
gitai suggest internal/You can skip the interactive hint prompt by providing it via CLI or disabling it:
gitai suggest -H "Fix login race condition" # Use hint and skip prompt
gitai suggest --no-hint # Skip prompt without hintYou can override the configured AI backend for a single run:
gitai suggest --provider=gpt # OpenAI
gitai suggest --provider=anthropic # Anthropic (Claude)
gitai suggest --provider=groq # Groq
gitai suggest --provider=deepseek # DeepSeek
gitai suggest --provider=xai # XAI (Grok)
gitai suggest --provider=ollama # Local Ollama
gitai suggest --provider=gemini # Google GeminiUse the review command to get AI-powered feedback on your changes before committing:
gitai reviewYou can target specific files:
gitai review internal/main.go README.mdLike suggest, you can provide hints or skip the hint prompt:
gitai review -H "Focus on error handling"
gitai review --no-hintOutput format can be controlled with --format:
gitai review --format jsonConfiguration is managed with Viper and supports CLI flags, environment variables, and config files (e.g., gitai.yaml).
Priorities: Flags > Env Vars > Config Files > Defaults.
Detailed configuration guides are available in the Project Wiki:
- Configuration Reference (All options & files)
- AI Providers (Setup for GPT, Claude, Groq, DeepSeek, XAI, Gemini, Ollama)
- Customization (Editors, styles)
- Security (Keyword scanner & privacy)
- Internals (Architecture & How it works)
ai:
provider: gpt # gpt | anthropic | groq | deepseek | xai | gemini | ollama
model: "" # Optional: specific model (e.g. "claude-3-opus", "llama3-70b")
temperature: 0.7
suggest:
editor: builtin # builtin | system | "code -w"GITAI_AI_PROVIDER: Override provider (e.g.ollama)GITAI_AI_API_KEY: API key for cloud providers
To run locally while developing:
- Ensure Go is installed and
GOPATH/GOMODare configured (this repo uses Go modules). - Run the CLI directly from source:
go run ./main.go suggestRun the unit tests using make or the standard Go toolchain. Tests are designed to run without external dependencies (using mocks for AI providers).
# Run all tests
make test
# Or using the Go toolchain directly
go test ./...If you have golangci-lint installed, you can also run the linter:
make lint- Add a new adapter under
internal/aithat implements a function returning (string, error). - Wire it into
GenerateCommitMessageor create a configuration switch.
This project uses GoReleaser and GitHub Actions for releases. To create a new release:
- Update the VERSION file: Change the version number in the
VERSIONfile (e.g.,1.2.3). - Push to main: When the change is merged or pushed to the
mainbranch, a GitHub Action automatically:- Creates a new git tag (e.g.,
v1.2.3). - Builds binaries for multiple platforms via GoReleaser.
- Creates a GitHub Release with a changelog and assets.
- Updates the Homebrew tap at
artback/homebrew-gitai. - Publishes Linux packages (DEB/RPM).
- Creates a new git tag (e.g.,
Note: Ensure
TAP_GITHUB_TOKENis configured in the repository secrets for the Homebrew tap update to work.
Contributions are welcome! Please see our Contributing Guide for details.
- Local Keyword Scanner: Gitai includes a built-in security layer that scans your diffs for sensitive information (like
api_key,password,private_key) locally. If a match is found, it will warn you and block the request to the AI provider. - Third-party AI: The tool sends diffs and repository metadata to third-party AI providers when generating messages. Treat this like any other service that may upload code. Do not send secrets or sensitive data to remote AI providers.
- Offline Workflow: For maximum privacy, run local models via Ollama. Gitai supports local Ollama endpoints, ensuring your code never leaves your machine.
This project is released under the MIT License. See LICENSE for details.
Vusal Huseynov — original author
Jonathan Artback - contributor
