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.2.tar.gz (17.3 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.2-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: git_to_doc-0.2.2.tar.gz
  • Upload date:
  • Size: 17.3 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.2.tar.gz
Algorithm Hash digest
SHA256 e408981511d4e055ec2bf84ff40d1c3cf691db667cdf396ff1c4c45ec82674f5
MD5 40248cff96cd5cf52242a457a2b5d9cd
BLAKE2b-256 55258308deeaf3f8b32d3af12c92ddb6750e9f979b0cbf2cbd7793df845d3e7d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: git_to_doc-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 19.8 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 92013ec44978a028be9697616460586cfa97d8e5b7fd88a2d34d0baac3dda4df
MD5 c1175854822eba8cb15fad7b43e52496
BLAKE2b-256 2e9ae8ae0553dc64e062dd6ad592d3c98a836dd74bb6b5713e0335cbb0a86517

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