Do you ever wanted a tool to standardize your git commits? Also to generate the changelog based on commits? Here is git-changelog. This is a NodeJS project but we provide standalone builds that enhances the git commit
command. You can use git changelog
as you use git commit
with the same arguments, except -m
.
- Go to releases
- Download the version that fits your system and extract the executable file where you can keep the executable forever
- Run the executable with
-i
option, example:./git-changelog-linux-x64 -i
- Now you have the
git changelog
command
If you have a problem when executing the file on Linux/MacOS do a chmod +x git-changelog-YOUROS/ARCH
before executing it.
When you run git changelog
the command will look for a .gitchangelog file in the current directory of the execution. The default .gitchangelog if there's no file or attribute is explained bellow.
{
"changelogFilename": "CHANGELOG.md",
"changelogTemplate": "default",
"commitTemplate": "karma",
"types": {
"feat": "new feature for the user, not a new feature for build script",
"fix": "bug fix for the user, not a fix to a build script",
"docs": "changes to the documentation",
"style": "formatting, missing semi colons, etc; no production code change",
"refactor": "refactoring production code, eg. renaming a variable",
"test": "adding missing tests, refactoring tests; no production code change",
"chore": "updating grunt tasks etc; no production code change"
},
"scopes": [],
"labels": [
"action",
"version"
],
"beforeCommit": [],
"afterCommit": []
}
The name of the changelog file.
The changelog template. All templates are executed with doT syntax and you have the following properties from the it
var:
{
"type": null, // string with type
"scope": null, // string with scope
"subject": null, // string with subject
"body": null, // null or array with the changes as strings
"labels": null // object with key-value labels
}
The default changelog template is placed at /templates/changelog path of this repo. You can specify a doT template in this attribute to customize the changelog entries.
The commit (git -m "[commitMessage]"
) template. This template follows the same approach of changelogTemplate
except that are two available options instead of default:
A key-value object with allowed types. The default pairs comes from karma. The description is shown when the user type git changelog --help
. Can also be a string with that points to a known preset, allowed values are:
karma
atom
An array with allowed scopes or leave it empty to allow user enter a custom scope.
An array with allowed labels to create custom markers for each commit. The user will input a value for each label.
An array with commands to execute before the commit and changelog update, if the command exits with a code different from 0 then the git changelog
will exit with the same code.
An array with commands to execute after the commit and changelog update, if the command exits with a code different from 0 then the git changelog
will exit with the same code.
The tests are built with mocha and chai, you can run with the following command:
npm run test