gen-changelog
Generate a 'keep a changelog' based change log from a git repository
gen-changelog is a release tool that generates changelogs in the Keep a Changelog format. It analyses a repository's commit history and uses conventional commit types to categorize and filter commits for inclusion in the changelog.
Table of Contents
Main Features
- Commit Categorization: Uses Conventional Commits specification to automatically categorize commits and filter them for changelog inclusion
- Summary Counts: Displays summary counts for each commit category in releases, including uncategorised (non-conventional) commits
- Detailed Commit Summaries: Shows commit details for Added, Fixed, Changed, and Security categories
- Security Classification: Automatically classifies commits made to the dependency scope as Security commits, regardless of their conventional commit type
- Flexible Configuration: Configurable mapping of commit types to headings, customizable heading display options, and optional commit summary counts
Gen-changelog CLI
A command-line tool that generates changelogs from git commits using conventional commit messages and keep-a-changelog formatting.
Installation
Install gen-changelog using Cargo:
Overview
Gen-changelog CLI automatically generates changelogs by analysing your git commit history. It uses conventional commit patterns to categorize changes and outputs them in a format compatible with Keep a Changelog.
Generate a change log based on the git commits compatible
with keep-a-changelog and using conventional commits to categorise commits.
Usage: gen-changelog [OPTIONS] [COMMAND]
Commands:
generate Generate changelog from git commits
config Manage configuration settings
help Print this message or the help of the given subcommand(s)
Options:
-v, --verbose... Increase logging verbosity
-q, --quiet... Decrease logging verbosity
-h, --help Print help
-V, --version Print version
Commands
generate
- Generate Changelog
Creates a changelog file based on your repository's commit history.
Options
Option | Description | Default |
---|---|---|
-n, --next-version <VERSION> | Version number for unreleased changes | - |
-s, --sections <NUMBER> | Number of version sections to include in changelog | All |
-c, --config-file <FILE> | Path to configuration file | - |
-r, --repo-dir <PATH> | Path to git repository | . (current directory) |
-d, --display-summaries | Show commit summaries in output | - |
--add-groups <GROUPS> | Include additional commit type groups | - |
--remove-groups <GROUPS> | Exclude specific commit type groups | - |
Examples
Generate a changelog for the current repository:
Generate with a specific next version:
Limit to the last 3 releases and show commit summaries:
config
- Configuration Management
Manage configuration settings for gen-changelog.
Options
Option | Description | Default |
---|---|---|
-s, --save | Save current configuration to file | - |
-f, --file <FILE> | Configuration file name | gen-changelog.toml |
-p, --show | Display current configuration | - |
Examples
Show the current configuration:
Save configuration to the default file:
Save configuration to a custom file:
Configuration File
Gen-changelog CLI uses a TOML configuration file to customize its behaviour. The default configuration file is gen-changelog.toml
in your project root.
To generate a configuration file with default settings and helpful comments:
How It Works
- Analyses Git History: Scans your repository's commit messages
- Applies Conventional Commits: Categorizes commits based on conventional commit patterns (feat, fix, chore, etc.)
- Groups Changes: Organizes commits by type and version
- Generates Changelog: Outputs formatted changelog following Keep a Changelog standard
Conventional Commit Support
gen-changelog recognizes standard conventional commit types:
- feat: New features
- fix: Bug fixes
- docs: Documentation changes
- style: Code style changes
- refactor: Code refactoring
- test: Test additions or changes
- chore: Maintenance tasks
Logging
Control output verbosity with logging options:
-v, --verbose
: Increase verbosity (can be used multiple times:-vv
,-vvv
)-q, --quiet
: Decrease verbosity (can be used multiple times:-qq
,-qqq
)
Getting Help
For command-specific help, use:
For general help and available commands:
Gen-changelog Library Documentation
The gen-changelog
library provides comprehensive changelog generation from Git repositories using conventional commit messages. The library centres around the ChangeLogConfig
and ChangeLog
structs for configuring and constructing changelog documents.
Installation
Add the library to your program's Cargo.toml
using cargo add
:
Or by configuring the dependencies manually in Cargo.toml
:
[]
= "0.0.8"
Default Configuration
The library provides sensible defaults for conventional commit types:
Default Groups
Group | Commit Types | Published |
---|---|---|
Added | feat | ✓ |
Fixed | fix | ✓ |
Changed | refactor | ✓ |
Security | security, dependency | ✗ |
Build | build | ✗ |
Documentation | doc, docs | ✗ |
Chore | chore | ✗ |
Continuous Integration | ci | ✗ |
Testing | test | ✗ |
Deprecated | deprecated | ✗ |
Removed | removed | ✗ |
Miscellaneous | misc | ✗ |
By default, only Added
, Fixed
, Changed
, and Security
groups are published in the changelog.
Configuration File
The library looks for a gen-changelog.toml
configuration file. Example structure:
## Controls the number of changelog sections to display.
= "all"
## Defines the display order of groups in the changelog.
[]
= "Added"
= "Fixed"
= "Changed"
= "Security"
## Group tables define the third-level headings used to organize commits.
[]
= "Added"
= true
= ["feat"]
[]
= "Fixed"
= true
= ["fix"]
## ... additional groups
Usage Examples
Basic Usage
use ;
use Repository;
Custom Configuration
use ;
use Repository;
Release Preparation
use ;
use Repository;
Requirements
- Git repository with conventional commit messages
- GitHub repository for generating comparison links
The library automatically detects GitHub repositories and generates appropriate comparison and release links in the changelog output.