To generate a changelog from git commits, here’s a straightforward approach you can use. This process extracts commit messages and formats them into a changelog style. Below is a step-by-step guide and a sample script to automate this:
Manual Method (Basic)
Run this command in your Git repository to get a simple list of commits:
-
%s— commit message subject -
%h— short commit hash -
--no-merges— exclude merge commits (optional)
This outputs a simple changelog-style list, e.g.:
Automated Script for More Detailed Changelog
If you want to generate a more structured changelog (grouped by type or date), here is a sample Bash script that extracts commits since the last tag, categorizes them, and outputs a changelog.
Using Tools
For professional changelog generation, consider using tools like:
-
git-chglog— generates changelogs based on commit history and templates. -
standard-version— automates versioning and changelog generation based on conventional commits. -
auto-changelog— generates changelogs from git tags and commit messages.
Let me know if you want me to generate a changelog from an example commit history or if you need a script tailored to a specific commit message style!