CLI that suggests git add/commit from diffs using Gemini
Project description
git-explain
Commit message block? Run this in your repo after you change files. It suggests git add and git commit lines you can copy—or apply in one step if you want. Nothing leaves your machine unless you turn on AI.
Install (Python 3.10+)
pip install git-explain
From source (this repo):
pip install -e .
Clone: install deps (requirements.txt is fine), cd into the repo, then:
python -m git_explain
Run that from the repo root so Python picks up the git_explain folder—no pip install -e . needed.
Optional: install a specific tag from GitHub instead of PyPI:
pip install "git+https://github.com/nazarli-shabnam/git-explain.git@v2.2.1"
Try it
- In any git repo, change or add a file (not ignored).
- Run:
git-explain
- Choose what to include (
allis fine), read the suggestion, answernif you only want to copy commands yourself—nothing bad happens.
Heuristics guess a sensible type and message from paths and statuses. No account, no key, no network for that path.
Suggested commits follow Conventional Commits—feat: …, fix: …, optional (scope), and so on—so changelogs and release tools can read them.
Optional: Gemini
If you want sharper messages, set GEMINI_API_KEY (or GOOGLE_API_KEY) in the environment or a .env file in the folder where you run the tool.
| Command | In plain terms |
|---|---|
git-explain --ai |
AI sees paths and change type only (no file contents). |
git-explain --ai --with-diff |
AI also sees the diff—better detail; only use if you’re OK sending that to the API. |
git-explain --suggest |
Staged only; prints one plain git commit -m "…" line (easy to copy). Needs AI; don’t combine with other flags. |
Everything else (--auto, --staged-only, --cwd, model override, shell completion): git-explain --help.
If Gemini complains
- 429 / quota — wait a bit, or try the default model; see Google’s rate limits.
- 404 / model not found — set something current, e.g.
GEMINI_MODEL=gemini-2.5-flash, and check their model list.
Developers
pip install -e ".[dev]"
pytest -q
Project details
Release history Release notifications | RSS feed
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 git_explain-2.2.1.tar.gz.
File metadata
- Download URL: git_explain-2.2.1.tar.gz
- Upload date:
- Size: 31.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2822469fe57579a18e10152fc8daae0e185550b437e50fbc210bc1511a2abc24
|
|
| MD5 |
2ff4012ceeca3fc7f1c3573366b62b50
|
|
| BLAKE2b-256 |
eba673cc86842cd70e0515d6b23d6a7d090e7ec021a7e0e5c3207d6f2c5d9c25
|
Provenance
The following attestation bundles were made for git_explain-2.2.1.tar.gz:
Publisher:
pypi-publish.yml on nazarli-shabnam/git-explain
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
git_explain-2.2.1.tar.gz -
Subject digest:
2822469fe57579a18e10152fc8daae0e185550b437e50fbc210bc1511a2abc24 - Sigstore transparency entry: 1237790198
- Sigstore integration time:
-
Permalink:
nazarli-shabnam/git-explain@6b76b7e519f6be6353b05c5d4130d9162a1799a9 -
Branch / Tag:
refs/tags/v2.2.1 - Owner: https://github.com/nazarli-shabnam
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@6b76b7e519f6be6353b05c5d4130d9162a1799a9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file git_explain-2.2.1-py3-none-any.whl.
File metadata
- Download URL: git_explain-2.2.1-py3-none-any.whl
- Upload date:
- Size: 29.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
414861b637c0f20b31e5f6a6e324fa3e28588848c09e6f8f8a07ed90c63a20b4
|
|
| MD5 |
6aaf7afa7bd3c1ef05767ddfd5841635
|
|
| BLAKE2b-256 |
f9e24a48ea5bf858ddd3623f404a274f2454cbe6dd7825344f1603f948cf53f1
|
Provenance
The following attestation bundles were made for git_explain-2.2.1-py3-none-any.whl:
Publisher:
pypi-publish.yml on nazarli-shabnam/git-explain
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
git_explain-2.2.1-py3-none-any.whl -
Subject digest:
414861b637c0f20b31e5f6a6e324fa3e28588848c09e6f8f8a07ed90c63a20b4 - Sigstore transparency entry: 1237790271
- Sigstore integration time:
-
Permalink:
nazarli-shabnam/git-explain@6b76b7e519f6be6353b05c5d4130d9162a1799a9 -
Branch / Tag:
refs/tags/v2.2.1 - Owner: https://github.com/nazarli-shabnam
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@6b76b7e519f6be6353b05c5d4130d9162a1799a9 -
Trigger Event:
push
-
Statement type: