cz-conventional-commit

January 14, 2018 ยท View on GitHub

commitizen adapter following the conventional-changelog format, with emojis and additionnal commit types (aliases).

Travis Codecov Greenkeeper badge license

Screenshot

Install as a global utility

npm install --global commitizen @metahub/cz-conventional-commit

Create a .czrc file in your home directory, with the following content:

{
  "path": "@metahub/cz-conventional-commit",
  "cz-conventional-commit": {
    "maxSubjectLength": 72,
    "bodyLineLength": 100
  }
}

Now cd into any git repository and use git cz instead of git commit and you will find the commitizen prompt.

See commitizen documentation for more informations.

Making your repo Commitizen-friendly

npm install --save-dev commitizen @metahub/cz-conventional-commit
./node_modules/.bin/commitizen init @metahub/cz-conventional-commit --save-dev

You can customize cz-conventional-commit in package.json:

...
"config": {
  "commitizen": {
    "path": "@metahub/cz-conventional-commit",
    "cz-conventional-commit": {
      "maxSubjectLength": 72,
      "bodyLineLength": 100,
      "emoji": true
    }
  }
}
...

See commitizen documentation for more informations.

Options

OptionDescriptionDefault
maxSubjectLengthLength at which to truncate the commit head (head includes type, scope, subject and emoji)72
bodyLineLengthLength at which to wrap body lines100
emojiTo add and emoji at the end of the commit messagefalse

Commit types

Commit TypeTitleDescriptionEmoji
featFeaturesA new featureโœจ
fixBug FixesA bug Fix๐Ÿ›
docsDocumentationDocumentation only changes๐Ÿ“š
styleStylesChanges that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)๐Ÿ’Ž
refactorCode RefactoringA code change that neither fixes a bug nor adds a feature๐Ÿ“ฆ
perfPerformance ImprovementsA code change that improves performance๐Ÿš€
testTestsAdding missing tests or correcting existing tests๐Ÿšจ
buildBuildsChanges that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)๐Ÿ› 
ciContinuous IntegrationsChanges to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)โš™๏ธ
choreChoresOther changes that don't modify src or test filesโ™ป๏ธ
revertRevertsReverts a previous commit๐Ÿ—‘

Commit aliases

Aliases are additionnal commit types that will be formatted to follow AngularJS Commit Message Conventions and automatically set some fields.

For example when choosing initial, cz-conventional-commit will automatically set:

  • the standard type to feat
  • the scope to empty
  • the subject to 'Initial commit ๐ŸŽ‰'
  • the issues to empty
  • the breaking to empty

The commit message will be feat: Initial commit ๐ŸŽ‰.

Commit TypeTypeScope (default)Subject (default)Emoji
initialfeatemptyInitial commit๐ŸŽ‰
dependenciesfixpackage-โซ
peerDependenciesfixpackage-โฌ†๏ธ
devDependencieschorepackage-๐Ÿ”ผ
metadatafixpackage-๐Ÿ“ฆ