Skip to main content

🧠 CommitBro

CommitBro is a privacy-first, local-friendly Git commit message generator that uses modern LLMs like Mistral, Starling, or TinyLlama — all running locally via Ollama, or optionally via a hosted FastAPI backend.


✨ Features

  • 🔐 100% privacy-first — no data leaves your machine
  • 🤖 Generates commit messages from git diff --cached
  • 🎯 Instruction-tuned LLMs: Mistral, TinyLlama, Starling, Gemma, etc.
  • 🧠 Optional training from your own commit history
  • 🧰 FastAPI backend included (for training and expansion)
  • 🌍 Supports multi-language commit messages
  • 🐳 Docker-ready for container lovers

📦 Installation

1. Clone and Install (Dev Mode)

git clone https://github.com/yourusername/commitbro.git
cd commitbro
pip install -e .

Requires Python 3.12+, Ollama, and git.

2. Run Setup

commitbro-setup

Choose:

  • Your preferred language (e.g. English, Spanish, Hindi)
  • Whether to train models (locally, remotely, or skip)
  • Your preferred model (mistral, tinyllama, etc.)

🚀 Usage

  1. Stage your changes:

    git add .
    
  2. Generate commit message:

    commitbro
    
  3. Accept, regenerate, or cancel:

    Suggested Commit Message:
    > Fix user login state handling on timeout
    
    ✅ Accept this? [y/n/r]: 
    
  4. If accepted, CommitBro will automatically commit your changes.


⚙️ Configuration

CommitBro stores user settings in:

~/.commitgen/config.json

Sample config:

{
  "language": "English",
  "training": "none",
  "remote_training_url": "",
  "model": "mistral"
}

You can change the model, language, or training config anytime by rerunning:

commitbro-setup

🧠 Model Support (via Ollama)

Run any local model supported by Ollama:

Model Size Speed Notes
tinyllama ~1.1B ⚡⚡⚡ Very fast, small commits
mistral 7B ⚡ General purpose, accurate
starling 7B ⚡ Optimized for dialogue
phi 2.7B ⚡⚡ Compact + reasoning
gemma:2b 2B ⚡⚡ Google’s latest compact model

To pull models:

ollama pull mistral
ollama run mistral

🛠️ Training

Extract commit history and send to remote training server:

commitbro-train

Only enabled if you selected remote or both training during setup.

You can use the included FastAPI server for training endpoints (see below).


🌐 FastAPI Backend (Optional)

A minimal FastAPI server is included for collecting commit training data.

Run it locally:

cd fastapi_server
uvicorn main:app --reload

Available Endpoint:

  • POST /train — Accepts commit history for training
{
  "commits": [
    {
      "hash": "abc123",
      "message": "Fix bug in login flow",
      "body": "Adjusted redirect logic in session manager"
    }
  ]
}

🐳 Docker Support

Run CommitBro inside a container (CLI mode):

docker build -t commitbro .
docker run --rm -v $(pwd):/app commitbro

Or to expose FastAPI:

docker run -p 8000:8000 commitbro uvicorn fastapi_server.main:app --host 0.0.0.0 --port 8000

📁 Project Structure

commitbro/
  ├── cli.py              # Main CLI logic
  ├── core.py             # Git diff + model API
  ├── train.py            # Training script
  ├── setup_config.py     # First-time setup wizard

fastapi_server/
  └── main.py             # Remote training API

pyproject.toml            # Modern packaging config
Dockerfile                # Optional container setup
README.md                 # You're reading it!

🧰 Packaging & Build

Uses hatchling and pyproject.toml (PEP 621).

Install locally:

pip install -e .

🧪 Roadmap

  • CLI with diff-based message generation
  • Language + training setup wizard
  • Remote FastAPI training backend
  • VS Code extension
  • Frontend (Next.js + ShadCN UI)
  • Auth + analytics-free SaaS version

🧑‍💻 Author

Built with 💚 by @aidataguy


📜 License

MIT License — do whatever you want, just keep it open.

Metadata

Release files for commitbro 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for commitbro 0.1.0
File Size Uploaded Provenance Actions
commitbro-0.1.0.tar.gz 5.6 kB Without provenance Details for commitbro-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for commitbro 0.1.0
File Interpreter ABI Platform Actions
commitbro-0.1.0-py3-none-any.whl Python 3 none any Details for commitbro-0.1.0-py3-none-any.whl

Total release size: 12.8 kB

Release files / commitbro-0.1.0.tar.gz

Download URL commitbro-0.1.0.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2a90b59d447867510cfc0e548ad97c07e7fdbce1c4f15587bcbee47114ec679c
BLAKE2b-256 checksum
How to use checksums
90cfcd9ab98c2b6cd5d222e99e7c16a0d52b4635596bd0b79dfc92f232aa0f88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.11

Release files / commitbro-0.1.0-py3-none-any.whl

Download URL commitbro-0.1.0-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
04a7b68f10a6818cbb951a8db974673c927489e27a151b9bc03cb300d8a0f4ce
BLAKE2b-256 checksum
How to use checksums
a2487ddac71d7e627e1c8d47f26ff71f81df6d1b4c12d6c47c2a7fa97ab606a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.11

Security for commitbro 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page