Skip to main content

GitRepository

The GitRepository class provides access to Git repository data.

Constructor

Path
required
Path to the Git repository directory.

Methods

iter_commits()

Iterate over commits in a specified range.
CommitRange
required
Range specification for commits to fetch.
Returns: Iterator of CommitInfo objects Example:

list_tags()

List all tags in the repository, sorted by date (newest first).
Returns: List of TagInfo objects Example:

get_github_slug()

Extract GitHub owner/repo from remote URL.
Returns: Tuple of (owner, repo) or None if not a GitHub repository Example:

CommitRange

Specification for a range of commits to process.

Constructor

Parameters

str
Starting ref (tag, commit SHA, branch, or date expression).Commits after this ref are included.
str
default:"HEAD"
Ending ref. Commits up to and including this ref are included.
bool
default:"true"
Whether to include merge commits.
Excluding merge commits often produces cleaner release notes.
int
Maximum number of commits to process.
Useful for testing or when you only need recent changes.

Data models

CommitInfo

Example:

TagInfo

Example:

Complete examples

Basic commit fetching

Working with tags

Unreleased changes

Filtering by commit type

GitHub integration


Error handling


Next steps

Changelog builder

Build changelogs from commits

Python API

Complete API reference

Examples

See practical examples

Conventional Commits

Learn about commit parsing