git-commit-message-convention

December 12, 2020 ยท View on GitHub

Extend git commit message from angular style

Commit Message Format

All Commit Message Format MUST meet this Text Format:

[:<Emoji>: ][<Type>[(<Scope>)]: ]<Subject>
[<BLANK LINE>]
[<Message Body>]
[<BLANK LINE>]
[<Message Footer>]

Types

TypeDescription
newfor new feature implementing commit
featurefor new feature implementing commit (equal new)
updatefor update commit
bugfor bug fix commit
securityfor security issue fix commit
performancefor performance issue fix commit
improvementfor backwards-compatible enhancement commit
breakingfor backwards-incompatible enhancement commit
deprecatedfor deprecated feature commit
i18nfor i18n (internationalization) commit
a11yfor a11y (accessibility) commit
refactorfor refactoring commit
docsfor documentation commit
examplefor example code commit
testfor testing commit
depsfor dependencies upgrading or downgrading commit
configfor configuration commit
buildfor packaging or bundling commit
releasefor publishing commit
wipfor work in progress commit
chorefor other operations commit

If the prefix is the below types, it will appear in the changelog.

  • new (feature)
  • bug
  • performance
  • security
  • improvement
  • deprecated
  • breaking

Scope

The scope could be anything specifying place or category of the commit change. For example location,location, browser, compile,compile, rootScope, ngHref, ngClick, ngView, feature1, etc...

Subject

The subject contains succinct description of the change:

  • use the imperative, present tense: "change" not "changed" nor "changes"
  • don't capitalize first letter
  • no dot (.) at the end

Message 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.

Message Footer

The Message Footer should contain any information about Notes and also Message Footer should be recommended GitHub Issue ID Reference, Ex. Issue #27, Fixes #1, Closes #2, Resolves #3.

Notes should start with the word NOTE: with a space or two newlines. The rest of the commit message is then used for this.

Revert

If the commit reverts a previous commit, it should begin with revert:, followed by the header of the reverted commit. In the body it should say: This reverts commit ., where the hash is the SHA of the commit being reverted.

Emojis

EmojiRaw Emoji CodeTypeDescription
:star::star:new or featureadd new feature
:bug::bug:bugfix bug issue
:ambulance::ambulance:bugcritical hotfix bug issue
:lock::lock:securityfix security issue
:chart_with_upwards_trend::chart_with_upwards_trend:performancefix performance issue
:zap::zap:improvementupdate backwards-compatible feature
:boom::boombreakingupdate backwards-incompatible feature
:warning::warning:deprecateddeprecate feature
:globe_with_meridians::globe_with_meridians:i18nupdate or fix internationalization
:wheelchair::wheelchair:a11yupdate or fix accessibility
:rotating_light::rotating_light:refactorremove linter/strict/deprecation warnings
:shirt::shirt:refactorrefactoring or code layouting
:white_check_mark::white_check_mark:testadd tests, fix tests failur or CI building
:pencil::pencil:docsupdate documentation
:copyright::copyright:docsdecide or change license
:lollipop::lollipop:examplefor example or demo codes
:lipstick::lipstick:updateupdate UI/Cosmetic
:up::up:updateupdate other
:truck::truck:updatemove or rename files, repository, ...
:twisted_rightwards_arrows::twisted_rightwards_arrows:updatemerge conflict resolution
:heavy_plus_sign::heavy_plus_sign:updateadd files, dependencies, ...
:heavy_minus_sign::heavy_minus_sign:updateremove files, dependencies, ...
:on::on:updateenable feature and something ...
:arrow_up::arrow_up:depsupgrade dependencies
:arrow_down::arrow_down:depsdowngrade dependencies
:pushpin::pushpin:depspin dependencies
:wrench::wrench:configupdate configuration
:package::package:buildpackaging or bundling or building
:whale::whale:buildDockerfile
:hatching_chick::hatching_chick:releaseinitial commit
:confetti_ball::confetti_ball:releaserelease major version
:tada::tada:releaserelease minor version
:sparkles::sparkles:releaserelease patch version
:rocket::rocket:releasedeploy to production enviroment
:bookmark::bookmark:releasetagged with version label
:back::back:revertrevert commiting
:construction::construction:wipWIP commiting

Ask to Be Creative!

Examples

new:

:star: new(graphite): add 'graphiteWidth' option

bug fix:

:bug: fix(graphite): stop graphite breaking when width < 0.1

Closes #28

improve performance:

:chart_with_upwards_trend: performance(graphite): remove graphiteWidth option

The graphiteWidth option has been removed. The default graphite width of 10mm is always used for performance reason.

revert:

:back: revert: new: add 'graphiteWidth' option

This reverts commit 667ecc1654a317a13331b17617d973392f415f02.

Support tools

conventional-changelog

You can use with conventional-changelog-cli and conventional-github-releaser.

e.g. conventional-changelog-cli:

$ npm i --save-dev git://github.com/kazupon/git-commit-message-convention.git
$ conventional-changelog -i CHANGELOG.md -s -n ./node_modules/git-commit-message-convention/convention.js -r 0

e.g. conventional-github-releaser:

$ conventional-github-releaser -n ./node_modules/git-commit-message-convention/convention.js -r 0

TODO

  • support conventional commit tools (e.g. conventional-changelog)
  • lint
  • cli
  • create a conventional commit tools with golang

License

MIT

MIT