GitRepository
TheGitRepository 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.
CommitInfo objects
Example:
list_tags()
List all tags in the repository, sorted by date (newest first).TagInfo objects
Example:
get_github_slug()
Extract GitHub owner/repo from remote URL.(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.
int
Maximum number of commits to process.Useful for testing or when you only need recent changes.
Data models
CommitInfo
TagInfo
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