changelog-gen-cli
v1.0.1
Published
Auto-generate CHANGELOG.md from git commit history using conventional commits
Maintainers
Readme
changelog-gen-cli
Auto-generate a CHANGELOG.md from your git commit history using Conventional Commits.
No external dependencies. Zero config. Works in any git repository.
Install
npm install -g changelog-gen-cliOr run once with npx:
npx changelog-gen-cliUsage
changelog-gen [options]
OPTIONS
--from=<ref> Start ref (tag, commit SHA, branch, HEAD~N). Default: all commits
--to=<ref> End ref. Default: HEAD
--output=<file> Output file path. Default: CHANGELOG.md
--overwrite Always overwrite output file (default: prepend to existing)
--version Print version
--help Show helpExamples
# Generate from last 10 commits
changelog-gen --from=HEAD~10
# Generate between two tags
changelog-gen --from=v1.0.0 --to=v2.0.0
# Custom output file, overwrite
changelog-gen --from=v1.2.0 --output=CHANGES.md --overwrite
# Prepend latest release to existing CHANGELOG.md
changelog-gen --from=v1.3.0 --to=v1.4.0Conventional Commit Format
Your commits should follow the pattern:
type(scope): descriptionSupported types and their changelog sections:
| Type | Section |
|------------|----------------------------|
| feat | Features |
| fix | Bug Fixes |
| perf | Performance Improvements |
| refactor | Refactoring |
| docs | Documentation |
| build | Build System |
| ci | CI/CD |
| test | Tests |
| style | Styles |
| chore | Chores |
| revert | Reverts |
Adding ! after the type marks a BREAKING CHANGE:
feat!: drop Node 12 support
refactor(auth)!: rename login endpointNon-conventional commits are grouped under Other Changes.
Sample Output
# Changelog
All notable changes to this project will be documented in this file.
## [v2.0.0] - 2024-03-22
### BREAKING CHANGES
- **auth:** rename login endpoint (`a1b2c3d`)
### Features
- **ui:** add dark mode toggle (`e4f5a6b`)
- support multi-language output (`c7d8e9f`)
### Bug Fixes
- fix null pointer in parser (`0a1b2c3`)How It Works
- Runs
git log <from>..<to> --oneline --no-mergesto collect commits. - Parses each subject line with the Conventional Commits regex.
- Groups commits into sections (feat, fix, breaking, etc.).
- Writes a Markdown changelog block.
- By default, prepends the new section to an existing
CHANGELOG.md(preserving history). Use--overwriteto start fresh.
License
MIT
