Git-based changelog generator from conventional commits
pip install philiprehberger-changelog-genGit-based changelog generator from conventional commits.
pip install philiprehberger-changelog-gen
from philiprehberger_changelog_gen import generate_changelog
changelog = generate_changelog(
repo_path=".",
from_tag="v0.1.0",
version="0.2.0",
)
# Print markdown
print(changelog.to_markdown())
# Write to file (prepend to existing)
changelog.write("CHANGELOG.md", mode="prepend")
# Print to stdout
changelog-gen
# From a specific tag
changelog-gen --from v0.1.0 --version 0.2.0
# Write to file
changelog-gen --output CHANGELOG.md --prepend
# Only include commits scoped to "api"
changelog = generate_changelog(scope="api", version="0.2.0")
changelog-gen --scope api --version 0.2.0
The generator parses conventional commit messages:
feat: add user authentication
fix(auth): handle expired tokens
feat!: redesign API (breaking change)
chore: update dependencies
Commits are grouped by type: Features, Bug Fixes, Performance, Refactoring, Documentation, Tests, Chores, CI/CD, Build, Style.
## 0.2.0 (2026-03-10)
### Breaking Changes
- **api:** redesign authentication flow
### Features
- add user dashboard
- **auth:** add OAuth2 support
### Bug Fixes
- **db:** fix connection pool leak
| Function / Class | Description |
|---|---|
generate_changelog(repo_path, from_tag, to_ref, version, include_types, exclude_types, scope) | Generate a changelog from git history between tags/refs |
Changelog | Generated changelog content with to_markdown() and write(path, mode) methods |
CommitEntry | A parsed conventional commit (hash, type, scope, message, breaking, date, author) |
main() | CLI entrypoint for command-line usage |
pip install -e .
python -m pytest tests/ -v
If you find this project useful: