#
Conventional Commits
Conventional Commits is specification for adding human and machine readable meaning to commit messages.
#
Commit Message Structure
<type>[optional scope]: <description>
[optional body]
[optional footer]
#
Commit Types
#
Examples
feat: add jwt support
feat!: breaking change in API
feat!(ui): redesign user profile page
fix: fix SQL injection vulnerability
fix(database): resolve data race condition
docs: update setup section of README
style(login): correct indentation in login component
refactor: refactor user database schema
perf: optimize user retrieval code for faster response
test: add tests for jwt authentication
test(payment): add tests for the payment gateway
chore: update build script
chore(deps): update dependencies
build(docker): update Dockerfile to use node 14
ci: add job for integration tests
revert: revert commit a1b2c3d4e5f
#
Specification
The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.
Commits MUST be prefixed with a type, which consists of a noun, feat, fix, etc., followed by a colon and a space.
The type feat MUST be used when a commit adds a new feature to your application or library.
The type fix MUST be used when a commit represents a bug fix for your application.
An optional scope MAY be provided after a type. A scope is a phrase describing a section of the codebase enclosed in parenthesis, e.g., fix(parser):
A description MUST immediately follow the type/scope prefix. The description is a short description of the code changes, e.g., fix: array parsing issue when multiple spaces were contained in string.
A longer commit body MAY be provided after the short description, providing additional contextual information about the code changes. The body MUST begin one blank line after the description.
A footer MAY be provided one blank line after the body. The footer SHOULD contain additional issue references about the code changes (such as the issues it fixes, e.g., Fixes #13).
Breaking changes MUST be indicated in the footer AND by appending a ! after the type/scope. A BREAKING CHANGE introduces a breaking API change (correlating with MAJOR in Semantic Versioning). A BREAKING CHANGE can be part of commits of any type.
A description MUST be provided after the BREAKING CHANGE:, describing what has changed about the API, e.g., BREAKING CHANGE: environment variables now take precedence over config files.
The footer MUST only contain BREAKING CHANGE, external links, issue references, and other meta-information.
Types other than feat and fix MAY be used in your commit messages.