1.1.2 • Published 8 months ago

git-cm v1.1.2

Weekly downloads
-
License
ISC
Repository
-
Last release
8 months ago

A lightweight, independent, 0 configurations git commit message tool

✨ Allow one-time input of the commit message and then verify it to ensure compliance with AngularJS's commit message convention.

✨ Allow customization of your commit information through inquiry

✨ Allow adding configuration files in the project and customizing your git commit message,or using default configurations.

git-cm-verify-demo

git-cm-select-demo

Installing the command line tool

Installation is as simple as running the following command (if you see EACCES error, reading fixing npm permissions may help):

npm install -g git-cm

Using the command line tool

Simply use git-cm or cm instead of git commit when committing.

Supported command line options

git-cm
git-cm -a
git-cm -m 'type(scope): subject'
git-cm -am 'type(scope): subject'

or as an npm script:

  ...
  "scripts": {
    "commit": "git-cm"
  }

when you use git-cm, without a committing message, you'll be prompted to fill out any required commit fields at commit time with a format of the default configuration file.

you can see the format of the default configuration file in gitcommitrc.json

Of course, you can also create gitcommitrc.json file below in the root directory of your project, to overwriting the default file.

when you use git-cm, with a committing message, such as git-cm -m 'type(scope): subject', the message will be verified, whether to use AngularJS's commit message convention.


Recommended Commit Message Format

<type>(<scope>): <short summary>
  │       │             │
  │       │             └─⫸ Summary in present tense. Not capitalized. No period at the end.
  │       │
  │       └─⫸ Commit Scope: Optional, can be anything specifying the scope of the commit change.
  |                          In App Development, scope can be a page, a module or a component.
  │
  └─⫸ Commit Type: feat|fix|docs|style|refactor|test|chore|perf|ci|build|chore

The <type> and <summary> fields are mandatory, the (<scope>) field is optional.

❌ Bad:

update README to add how to install

✅ Good:

docs: update README to add how to install

✅ Good (commit message with scope):

docs(README): update README to add how to install

The default commit types can be extended or modified by gitcommitrc.json.

Zero Configurations

Configurations Not Required! If it has to be customized we have the guide below.

The default types includes feat, fix, docs, style, refactor, test, chore, perf, ci, build and chore.

The default max-len is 100 which means the commit message cannot be longer than 100 characters. All the settings can be modified in gitcommitrc.json.

gitcommitrc.json

Except for default types, you can add, overwrite.

For example if you have this gitcommitrc.json file below in the root directory of your project:

you can see the format of the example configuration file in gitcommitrc-example.json

{
  "types": [
    {
      "value": "feat",
      "name": "A new feature "
    },
    {
      "value": "fix",
      "name": "A bug fix "
    },
    {
      "value": "docs",
      "name": "Documentation only changes "
    },
    {
      "value": "style",
      "name": "Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc) "
    },
    {
      "value": "refactor",
      "name": "A code change that neither fixes a bug nor adds a feature "
    },
    {
      "value": "perf",
      "name": "A code change that improves performance"
    },
    {
      "value": "test",
      "name": "Adding missing tests or correcting existing tests"
    },
    {
      "value": "ci",
      "name": "Changes to your CI configuration files and scripts"
    },
    {
      "value": "build",
      "name": "Changes that affect the build system or external dependencies"
    },
    {
      "value": "chore",
      "name": "Changes to the build process or auxiliary tools and libraries such as documentation generation."
    }
  ],
  "messages": {
    "type": "(type) Select the type of change that you're committing: (Use arrow keys)",
    "scope": "(scope) Write a brief description of the scope of impact:",
    "subject": "(subject) Write a short, imperative tense description of the change:",
    "body": "(body) Provide a longer description of change, Wrap with :\n",
    "footer": "(footer) List any breaking changes:"
  },
  "maxLen": 100,
  "minLen": 0,
  "subjectLimit": 50,
  "skipQuestions": ["body", "footer"],
  "scopeRequired": false,
  "lang": "en-US"
}

Features

  1. Visualization, low cost to Learn.
  2. Independent, zero configurations.
  3. Support for local configuration files and customizing your git commit message.
  4. Prompt error msg precisely, friendly to commit message format unfamiliar developers.
  5. i18n: en-US, zh-CN supported.
  6. The linter is customizable for your team by configuring local files.
1.1.2

8 months ago

1.1.1

8 months ago

1.1.0

8 months ago

1.0.0

8 months ago