cg commitgen
Qwen2.5-Coder LoRA -> Ollama CLI

Diffs in. Commits out.

A local-first wrapper for a fine-tuned commit message model. Paste a staged diff, generate a conventional commit subject, then use the same flow from the terminal with commitgen commit.

Local setup
generated message deterministic demo
Paste a diff or use the sample, then generate a commit subject.

Preview is stable for the same diff and updates when the diff changes.

Model

Qwen2.5-Coder-0.5B-Instruct fine-tuned with LoRA on conventional commit examples from CommitBench. Training reached checkpoint-2000, about 71% of the planned run, before Colab GPU quota cut it off.

2.16Mtrainable params

Format Lift

The tuned adapter learns the commit type prefix instead of producing generic chat responses, moving from 0.8% type accuracy on the base model to 58.2%.

58.2%type accuracy

Local Runtime

The merged model is quantized to GGUF and served by Ollama, then wrapped by a zero-dependency CLI.

Q4_K_Mdeployment

Installation guide

The hosted page is the quick demo. The local install runs the real quantized model through Ollama and adds a commitgen command that reads staged Git diffs. Source code: github.com/Nilay-Mehta/commitgen.

1. Prepare the model

  1. Install Ollama.
  2. Place commitgen-Q4_K_M.gguf next to deployment/Modelfile.
  3. Run ollama create commitgen -f deployment/Modelfile.

2. Install the CLI

  1. Clone the repository.
  2. Run pip install -e deployment from the repo root.
  3. Confirm with commitgen --help.

3. Use it in Git

  1. Stage changes with git add.
  2. Run commitgen msg to preview.
  3. Run commitgen commit for confirm-edit-commit flow.
# Full local setup
git clone https://github.com/Nilay-Mehta/commitgen.git
cd commitgen

# Add commitgen-Q4_K_M.gguf to deployment/
ollama create commitgen -f deployment/Modelfile
pip install -e deployment

git add .
commitgen commit
# Optional local web preview
python -m http.server 8000

# Open:
http://localhost:8000/web/
# CLI modes
commitgen msg
commitgen commit
commitgen push

# The CLI always asks before committing,
# and supports edit/retry from the prompt.