A CLI to keep semantic git commits. With emoji support 😄 👍
Many projects got different git commit rules. It is hard to remember them all. Usually you start with git commit -m "
, and then? You have to think about the projects commit guidelines.
sgc
will take care of the commit guidelines, so you can focus on the more important stuff: code
$ npm i -g semantic-git-commit-cli
or
$ yarn add global semantic-git-commit-cli
Forget the times when you used git commit -m "..."
, now just type:
$ sgc
or if you already have an alias for sgc, use following instead:
$ semantic-git-commit
Configure sgc for the following semantic-release options:
analyzeCommits
andgenerateNotes
First step, install the following plugins with
$ npm install --save-dev sr-commit-analyzer sr-release-notes-generator conventional-changelog-eslint
or
$ yarn add -D sr-commit-analyzer sr-release-notes-generator conventional-changelog-eslint
Then, add this in your package.json
:
{
"release": {
"analyzeCommits": {
"path": "sr-commit-analyzer",
"preset": "eslint"
},
"generateNotes": {
"path": "sr-release-notes-generator",
"preset": "eslint"
}
}
}
Just create a
.sgcrc
in your project root or you can add everything in yourpackage.json
with the valuesgc
You can even create a global config. Just go to your users home and create a .sgcrc
. The global config will be triggered if no project configurations are present.
Options:
Type: boolean
Default: true
Asks if more info (body) should be added. This will open your default editor.
Example:
{
"body": false
}
Type: boolean
Default: false
Asks for the scope in parentheses of the commit.
Example:
{
"scope": true
}
Type: boolean
Default: false
A boolean to enable emoji at the beginning of a commit message
Example:
{
"emoji": true
}
Type: boolean
Default: false
A boolean to lowercase types.
Example:
{
"lowercaseTypes": true
}
Type: object
Default:
{
"initial-commit": {
"isEnabled": true,
"emoji": ":tada:",
"message": "Initial commit"
}
}
Keys:
isEnabled
- Whether an explicit initial commit should be used for the very first commitemoji
- An emoji which will be appended at the beginning of the commit (Emoji Cheat Sheet)message
- The commit message for the very first commit
Types will define your git commits. If
types
is not set in your own.sgcrc
, thetypes
of the global .sgcrc
Keys
type
- This will be your commit convention and will be your start of your commit - e.g.:Feat:
description
(optional) - The description to explain what your type is aboutemoji
(optional) - An emoji which will be appended at the beginning of the commit (Emoji Cheat Sheet)
The .sgcrc
:
{
"types": [
{
"emoji": ":sparkles:",
"type": "Feat:",
"description": "Any description to describe the type"
}
]
}
or the package.json
:
{
"name": "Your application name",
"version": "1.0.0",
"sgc": {
"types": [
{
"emoji": ":sparkles:",
"type": "Feat:",
"description": "Any description to describe the type"
}
]
}
}
Available rules:
Type: number
Default: 72
If a number is set, it will not allow to commit messages more than the given number. If it is set to -1
the rule is deactivated
Example:
{
"rules": {
"max-char": -1
}
}
Type: number
Default: 10
If a number is set, it will not allow to commit messages less than the given number. If it is set to -1
the rule is deactivated
Example:
{
"rules": {
"min-char": -1
}
}
Type: boolean
Default: true
If it is set to false, it will not allow to commit messages with a dot at the
Example:
{
"rules": {
"end-with-dot": false
}
}