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 (saves to markdown by default)
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
git-to-doc https://github.com/google/jax/pull/123 --output stdout # print to terminal

# 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.3.tar.gz (17.4 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.3-py3-none-any.whl (19.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: git_to_doc-0.2.3.tar.gz
  • Upload date:
  • Size: 17.4 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.3.tar.gz
Algorithm Hash digest
SHA256 7861a9e117b934fe2e7e1185d51c0daa9cd1e0308d4a925460896e936e5fec1c
MD5 738c31b21b6fb065d5db6d9f75b26351
BLAKE2b-256 f26768ac59083e5f397ca8bb374b8ad7805f4c5434e1cce5174c0a86434f9e7a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: git_to_doc-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 19.9 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 55604c39d6c0aab3151c17bd355f3ee4d7d2c1e78bf246ad57a1fd3a35348d20
MD5 23dfaeb73073e3c7d5e0e78a77323249
BLAKE2b-256 29278d565b98234fd999e77752c2124328cd382d7b1ad6d131079b97d89ab049

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