🤖 AI-powered Git CLI assistant built with Go. Automate commit messages, enforce pre-commit policies, detect secrets, and improve code quality with LLM-based suggestions.
16
stars
69
commits
Go
primary language
Dec 26, 2025
updated
Gitai is an open-source CLI tool that helps developers generate high-quality git commit messages using AI. It inspects repository changes (diff + status) and provides concise, actionable suggestions via an interactive TUI.
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).
git clone https://github.com/yourusername/gitai.git
cd gitai
make build
make install
# or if you want to personalize the keywords for the safety check of your diff
make install-personalized-keys "comma,separated,keys"
The 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.
Generate commit message suggestions using the interactive TUI:
gitai suggest
Selecting AI provider (flag or env)
You can choose which AI backend to use with a flag or environment variable. The --provider flag overrides the env var for that run.
# use local Ollama via flag
gitai suggest --provider=ollama
# use OpenAI GPT
gitai suggest --provider=gpt
# use Gemini
gitai suggest --provider=gemini
# use Gemini cli
gitai suggest --provider=gemini_cli
gitai suggest will:
git status --porcelain)e) or regenerating it (press r)See internal/tui/suggest for the implementation of the flow.
Configuration is managed with Viper and can be provided from, in order of precedence (highest first):
You can mix and match; higher‑precedence sources override lower ones.
Supported keys
Config files
Example gitai.yaml
ai:
provider: gpt # gpt | gemini | ollama | geminicli
api_key: "sk-..." # Optional here; can be provided via env/flag
# Only needed if you use provider=ollama
ollama:
path: "/usr/local/bin/ollama"
suggest:
editor: builtin # Use the built-in TUI editor
Example gitai.json
{
"ai": {
"provider": "gpt",
"api_key": "sk-..."
},
"ollama": {
"path": "/usr/local/bin/ollama"
},
"suggest": {
"editor": "builtin"
}
}
Examples
gitai suggest --provider=ollamaexport GITAI_AI_API_KEY="sk-..."gitai suggest --provider=gptgitai suggest --editor=builtingitai suggest --editor="code -w"gitai suggestNotes
Core components live under internal/:
internal/ai — adapters for AI backends and the main prompt (GenerateCommitMessage)internal/git — helpers that run git commands and parse diffs/status (helpers used by the TUI)internal/tui/suggest — TUI flow (file selector → AI message view)The entrypoint is main.go which dispatches to the Cobra-based CLI under cmd/.
To run locally while developing:
GOPATH/GOMOD are configured (this repo uses Go modules).go run ./main.go suggest
If tests are added, run them with:
go test ./...
internal/ai that implements a function returning (string, error).GenerateCommitMessage or create a configuration switch.Contributions are welcome. Please follow the guidelines in CONTRIBUTING.md.
Suggested contribution workflow:
If you'd like help designing an enhancement (hooks, CI integrations, new backends), open an issue first to discuss.
OLLAMA_API_PATH configured.This project is released under the MIT License. See LICENSE for details.
Vusal Huseynov — original author
Go
97.4%
Makefile
2.6%
🤖 AI-powered Git CLI assistant built with Go. Automate commit messages, enforce pre-commit policies, detect secrets, and improve code quality with LLM-based suggestions.
16
stars
69
commits
Go
primary language
Dec 26, 2025
updated
Gitai is an open-source CLI tool that helps developers generate high-quality git commit messages using AI. It inspects repository changes (diff + status) and provides concise, actionable suggestions via an interactive TUI.
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).
git clone https://github.com/yourusername/gitai.git
cd gitai
make build
make install
# or if you want to personalize the keywords for the safety check of your diff
make install-personalized-keys "comma,separated,keys"
The 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.
Generate commit message suggestions using the interactive TUI:
gitai suggest
Selecting AI provider (flag or env)
You can choose which AI backend to use with a flag or environment variable. The --provider flag overrides the env var for that run.
# use local Ollama via flag
gitai suggest --provider=ollama
# use OpenAI GPT
gitai suggest --provider=gpt
# use Gemini
gitai suggest --provider=gemini
# use Gemini cli
gitai suggest --provider=gemini_cli
gitai suggest will:
git status --porcelain)e) or regenerating it (press r)See internal/tui/suggest for the implementation of the flow.
Configuration is managed with Viper and can be provided from, in order of precedence (highest first):
You can mix and match; higher‑precedence sources override lower ones.
Supported keys
Config files
Example gitai.yaml
ai:
provider: gpt # gpt | gemini | ollama | geminicli
api_key: "sk-..." # Optional here; can be provided via env/flag
# Only needed if you use provider=ollama
ollama:
path: "/usr/local/bin/ollama"
suggest:
editor: builtin # Use the built-in TUI editor
Example gitai.json
{
"ai": {
"provider": "gpt",
"api_key": "sk-..."
},
"ollama": {
"path": "/usr/local/bin/ollama"
},
"suggest": {
"editor": "builtin"
}
}
Examples
gitai suggest --provider=ollamaexport GITAI_AI_API_KEY="sk-..."gitai suggest --provider=gptgitai suggest --editor=builtingitai suggest --editor="code -w"gitai suggestNotes
Core components live under internal/:
internal/ai — adapters for AI backends and the main prompt (GenerateCommitMessage)internal/git — helpers that run git commands and parse diffs/status (helpers used by the TUI)internal/tui/suggest — TUI flow (file selector → AI message view)The entrypoint is main.go which dispatches to the Cobra-based CLI under cmd/.
To run locally while developing:
GOPATH/GOMOD are configured (this repo uses Go modules).go run ./main.go suggest
If tests are added, run them with:
go test ./...
internal/ai that implements a function returning (string, error).GenerateCommitMessage or create a configuration switch.Contributions are welcome. Please follow the guidelines in CONTRIBUTING.md.
Suggested contribution workflow:
If you'd like help designing an enhancement (hooks, CI integrations, new backends), open an issue first to discuss.
OLLAMA_API_PATH configured.This project is released under the MIT License. See LICENSE for details.
Vusal Huseynov — original author
Go
97.4%
Makefile
2.6%