simple-git-changelog2.1.0 • Public • Published
A simple AWK script to generate changelogs from your Git history.
There are many fancy tools for generating changelogs based on ones git commit history, but I wanted one that was dead-simple to use and not dependent on runtimes like Nodejs, Python, etc.
Depending on the type of project you're working on,
simple-git-changelog can be installed in different ways.
Nodejs projects: As an NPM dependency
Install this package as a devDependency for your project and call it via NPM scripts:
npm i -D simple-git-changelog
Clone or download the script to your machine and simply call it from the command line like any other script.
Call the script within a Git repository, and it will print a summary of changes to STDOUT in reverse-chronological order.
./changelog.awk # outputs Markdown./changelog.awk -v TYPE=plain # outputs plain text
The whole git log will be processed by default. But revision range can be provided in git accepted format. Use quotes if more than one arguments are specified.
./changelog.awk -v REVISION_RANGE=1.4.0./changelog.awk -v REVISION_RANGE="^1.4.0 1.8.0"
For NPM users
There is also an executable added to your local
node_modules/.bin/ path for convenience:
changelog: Non-destructive command that simply prints to STDOUT based on your Git commit history. Same as simply calling
So for example, you could add to your project's NPM scripts:
/* In your package.json: */..."scripts":,...
The script will order commits under their respective Git tags, assuming that they begin with "v" (ex.
v2.3.4, etc.) All other tags will be ignored.
Only commits that are prefixed with one of the following prefixes will be output:
fix: Fixed bug #123
docs: Updated README
refactor: Moved foobar into baz module
Commit links (Markdown output only)
In order to build the little links to each commit, the script will essentially run:
git config --get remote.upstream.url || git config --get remote.origin.url || git config --get remote.dev.url
So make sure that you have a remote labeled either
- Publish to