Giter VIP home page Giter VIP logo

git-cz's Introduction

Commitizen friendly

git-cz

image

Without installation

npx git-cz
# or
npx git-cz -e

Install globally standalone

npm install -g git-cz
git-cz
# or
git-cz -e

Install locally with Commitizen

npm install -g commitizen
npm install --save-dev git-cz

package.json:

{
  "config": {
    "commitizen": {
      "path": "git-cz"
    }
  }
}

run:

git cz

Install globally with Commitizen

npm install -g commitizen git-cz
commitizen init git-cz --save-dev --save-exact

run:

git cz

Custom config

You can provide a custom configuration in a changelog.config.js file in your repo, or in any parent folder. git-cz will search for the closest config file. Below is default config:

module.exports = {
  disableEmoji: false,
  format: '{type}{scope}: {emoji}{subject}',
  list: ['test', 'feat', 'fix', 'chore', 'docs', 'refactor', 'style', 'ci', 'perf'],
  maxMessageLength: 64,
  minMessageLength: 3,
  questions: ['type', 'scope', 'subject', 'body', 'breaking', 'issues', 'lerna'],
  scopes: [],
  types: {
    chore: {
      description: 'Build process or auxiliary tool changes',
      emoji: '๐Ÿค–',
      value: 'chore'
    },
    ci: {
      description: 'CI related changes',
      emoji: '๐ŸŽก',
      value: 'ci'
    },
    docs: {
      description: 'Documentation only changes',
      emoji: 'โœ๏ธ',
      value: 'docs'
    },
    feat: {
      description: 'A new feature',
      emoji: '๐ŸŽธ',
      value: 'feat'
    },
    fix: {
      description: 'A bug fix',
      emoji: '๐Ÿ›',
      value: 'fix'
    },
    perf: {
      description: 'A code change that improves performance',
      emoji: 'โšก๏ธ',
      value: 'perf'
    },
    refactor: {
      description: 'A code change that neither fixes a bug or adds a feature',
      emoji: '๐Ÿ’ก',
      value: 'refactor'
    },
    release: {
      description: 'Create a release commit',
      emoji: '๐Ÿน',
      value: 'release'
    },
    style: {
      description: 'Markup, white-space, formatting, missing semi-colons...',
      emoji: '๐Ÿ’„',
      value: 'style'
    },
    test: {
      description: 'Adding missing tests',
      emoji: '๐Ÿ’',
      value: 'test'
    },
    messages: {
      type: 'Select the type of change that you\'re committing:',
      customScope: 'Select the scope this component affects:',
      subject: 'Write a short, imperative mood description of the change:\n',
      body: 'Provide a longer description of the change:\n ',
      breaking: 'List any breaking changes:\n',
      footer: 'Issues this commit closes, e.g #123:',
      confirmCommit: 'The packages that this commit has affected\n',
    },
  }
};

Non-interactive mode

Using --non-interactive flag you can run git-cz non-interactive mode.

For example:

git-cz --non-interactive --type=feat --subject="add onClick prop to component"

CLI parameters:

  • --type
  • --subject
  • --scope
  • --body
  • --breaking
  • --issues
  • --lerna

Disable Emoji

Using --disable-emoji flag will disable emoji.

For example:

git-cz --disable-emoji

Commit message format

  • A commit message consists of a header, body and footer.
  • The header has a type and a subject:
<type>[(<scope>)]: <emoji> <subject>
[BLANK LINE]
[body]
[BLANK LINE]
[breaking changes]
[BLANK LINE]
[footer]

The header is the only mandatory part of the commit message.

The first line (type + subject) is limited to 50 characters [enforced]

Any other line should be limited to 72 character [automatic wrapping]

This allows the message to be easier to read on GitHub as well as in various git tools.

Format

By default the subject format is: {type}{scope}: {subject}

Configuring the format field in .git-cz.json you can customize your own:

  • {type}{scope}: {emoji}{subject}
  • {emoji}{scope} {subject}

Type

Must be one of the following:

  • test โ€” Adding missing tests
  • feat โ€” A new feature
  • fix โ€” A bug fix
  • chore โ€” Build process or auxiliary tool changes
  • docs โ€” Documentation only changes
  • refactor โ€” A code change that neither fixes a bug or adds a feature
  • style โ€” Markup, white-space, formatting, missing semi-colons...
  • ci โ€” CI related changes
  • perf โ€” A code change that improves performance

Subject

The subject contains succinct description of the change:

  • Use the imperative, present tense: "change" not "changed" nor "changes"
  • No dot (.) at the end.

Body

Just as in the subject, use the imperative, present tense: "change" not "changed" nor "changes". The body should include the motivation for the change and contrast this with previous behavior.

Affects [only on lerna environments]

Select the packages the commit affected.

Breaking Changes

Breaking Changes must start with the words BREAKING CHANGE: .

Footer

The footer is the place to reference any tasks related to this commit.

Why this Fork?

npm i -g git-cz
added 1 package in 0.612s

Installs in 0.6s vs 31.1s.

npm i -g mol-conventional-changelog
added 345 packages in 31.076s

git-cz's People

Contributors

renovate-bot avatar streamich avatar renovate[bot] avatar rodrigograca31 avatar semantic-release-bot avatar brokenmass avatar theashraf avatar dependabot[bot] avatar carpasse avatar alexathome avatar ikhemissi avatar jeromefitz avatar kamack38 avatar umutcanbolat avatar xram avatar stanlindsey avatar khaledosman avatar carlosvillademor avatar damusix avatar jeroenknoops avatar jlarmstrongiv avatar warapitiya avatar patsuitestudios avatar bogusweb avatar snaerth avatar allen-1998 avatar kyle7zhang avatar

Stargazers

Hazpi Nurafgan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.