Skip to main content

Conventional Commit messages, changelogs & PRs from git diffs using Gemma (local or cloud)

Project description

git-to-doc ⚡

Turn a git diff into developer documentation with a local or cloud Gemma model — Conventional Commit messages, markdown changelogs, and pull requests — straight from the terminal.

Install

pip install git-to-doc

Why

Developers write terrible commit messages and skip doc updates. git-to-doc is the plumbing that fixes that: feed it a diff, get back a spec-valid commit, a changelog snippet, and a plain-English summary. It can also write your PRs and auto-fill commit messages via a git hook.

Backend (auto-detected)

  • Cloud: set OLLAMA_API_KEY (in a .env or your environment) → uses ollama.com.
  • Local: no key → uses a local ollama daemon (localhost:11434).

Commands

# diff → commit message + changelog + plain-English summary
git-to-doc sample.diff
git-to-doc https://github.com/pallets/flask/pull/5000 --output both
git-to-doc ./diffs/ --output md           # batch a folder

# generate (and open) a pull request from the current branch
git-to-doc pull-request                              # preview
git-to-doc pull-request --create                     # push + open via gh
git-to-doc pull-request --draft --base develop

# install a git hook so `git commit` (no -m) auto-fills the message
git-to-doc install-hook

# benchmark models (timing; add --judge for rubric quality + CC pass-rate)
git-to-doc-compare sample.diff --models gemma3:4b gemma3:12b --judge gpt-oss:120b

Output Example

For each diff, git-to-doc produces a reviewer-first document:

📄 See a real rendered example → examples/PR-474.md (GitHub renders the callouts, collapsible sections, and code blocks natively)

How it's built for trust

  • Self-repair loop — every generated commit is checked against the Conventional Commits spec (validate.py); on failure the exact violations are fed back and the model regenerates. Output is guaranteed spec-valid, not hopeful.
  • Structured output — Pydantic schemas force valid JSON from the model.
  • Measured, not guessedgit-to-doc-compare --judge scores models with an LLM-as-judge rubric and a deterministic Conventional Commit pass-rate.

Library use

from git_to_doc import analyze_diff, render_full_output
doc = analyze_diff(open("sample.diff").read(), model="gemma4")
print(render_full_output(doc))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

git_to_doc-0.2.1.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

git_to_doc-0.2.1-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file git_to_doc-0.2.1.tar.gz.

File metadata

  • Download URL: git_to_doc-0.2.1.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for git_to_doc-0.2.1.tar.gz
Algorithm Hash digest
SHA256 2cdac90630154864ceb768c806acd834bccce12980cdb01a573664489073de29
MD5 2af8d4fa59e21b70ba764f2b3ea21afc
BLAKE2b-256 d7d3c82f7100631be57f110dacf62cfcc74ebd5e2b88e62c20370f43a26fda15

See more details on using hashes here.

File details

Details for the file git_to_doc-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: git_to_doc-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 19.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for git_to_doc-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ea67d6033711da77e79c901171e9346658d55461beb82fe178cc70ba26dec744
MD5 fa249b948db03a0336aba5507300161f
BLAKE2b-256 01c9bc8db3f560da34f6a5573457a80c67c1b82d7fb7b14e54458cff78a9e5d2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page