Skip to content

MooYooOrg/mooyoo-git-commit-cli

 
 

Repository files navigation

mooyoo-git-commit-cli

A CLI to keep semantic git commits. With emoji support 😄 👍

Why?

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.

mgc will take care of the commit guidelines, so you can focus on the more important stuff: code

Installation

升级到最新的 nodejs >= 9.11.1,最好选用最新版,配合最新的 npm >= 6

$ npm i -g MooYooOrg/mooyoo-git-commit-cli

Usage

Forget the times when you used git commit -m "...", now just type:

$ mgc

or if you already have an alias for mgc, use following instead:

$ semantic-git-commit

Config

Just create a .mgcrc in your project root or you can add everything in your package.json with the value mgc

You can even create a global config. Just go to your users home and create a .mgcrc. The global config will be triggered if no project configurations are present.

Options:

body

Type: boolean

Default: true

Asks if more info (body) should be added. This will open your default editor.

Example:

{
  "body": false
}

scope

Type: boolean

Default: false

Asks for the scope in parentheses of the commit.

Example:

{
  "scope": true
}

emoji

Type: boolean

Default: false

A boolean to enable emoji at the beginning of a commit message

Example:

{
  "emoji": true
}

lowercaseTypes

Type: boolean

Default: false

A boolean to lowercase types.

Example:

{
  "lowercaseTypes": true
}

initialCommit

Type: object

Default:

{
  "initialCommit": {
    "isEnabled": true,
    "emoji": ":tada:",
    "message": "Initial commit"
  }
}

Keys:

  • isEnabled - Whether an explicit initial commit should be used for the very first commit
  • emoji - 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

Types will define your git commits. If types is not set in your own .mgcrc, the types of the global .mgcrc

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 about
  • emoji (optional) - An emoji which will be appended at the beginning of the commit (Emoji Cheat Sheet)

The .mgcrc:

{
  "types": [
    {
      "emoji": ":sparkles:",
      "type": "Feat:",
      "description": "Any description to describe the type"
    }
  ]
}

or the package.json:

{
  "name": "Your application name",
  "version": "1.0.0",
  "mgc": {
    "types": [
      {
        "emoji": ":sparkles:",
        "type": "Feat:",
        "description": "Any description to describe the type"
      }
    ]
  }
}

rules

Available rules:

max-char

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
  }
}

min-char

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
  }
}

end-with-dot

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
  }
}

About

A CLI for semantic git commits

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%