Suggest conventional git add / git commit messages from your changes. Local heuristics by default (no network); add --ai for Google Gemini.
pip install git-explain
cd /path/to/your/git/repo # repo with local changes
git-explainUsing --ai? Put GEMINI_API_KEY=… (or GOOGLE_API_KEY) in a .env file at your project’s git root — the top of the repo you’re working in, not the folder where git-explain is installed.
Enter applies the suggested commands; n skips (copy only). Pin a release from GitHub:
pip install "git+https://github.com/nazarli-shabnam/git-explain.git@v2.3.0" (swap the tag as needed).
| Conventional commits | feat:, fix:, optional (scope), etc. — see spec. |
.env |
GEMINI_API_KEY or GOOGLE_API_KEY in .env at that repo’s git root (loaded after the repo is resolved). |
| Shell (one session) | Set the variable in the terminal; it overrides .env for that window. PowerShell: $env:GEMINI_API_KEY="…" then git-explain --ai. bash/zsh: export GEMINI_API_KEY="…". |
--auto |
Apply without the apply prompt. |
--staged-only |
Commit the index only (no git add from the tool). |
--cwd |
Treat another directory as the git repo root. |
--ai — model sees paths + status. --ai --with-diff — also sends the diff (more detail, data goes to the API). --suggest — staged + AI only: prints one git commit -m "…" line (no other flags). More: git-explain --help.
- 429 / quota — rate limits.
- 404 / model — e.g.
GEMINI_MODEL=gemini-2.5-flash; model list.
Smoke-test a branch: clone, pip install -r requirements.txt, run python -m git_explain from any git working tree (no pip install -e .). Day-to-day hacking: pip install -e ".[dev]" then pytest -q, ruff check ., ruff format --check ..
cd path/to/git-explain
pip install -r requirements.txt
python -m git_explain