The drupal-twig-extensions
project uses semantic commit messages. A minor change to your commit message style can:
- make you a better programmer
- helps to automate the CHANGELOG generated for other developers
Don’t worry. You can still submit a Pull Request and if you don’t properly use semantic commit messages, we will edit the commits to add them. But we like them, so you might too.
<type>(<scope>)<!>: <subject>
<body>
(<scope>)
is optional. If it is not included in a commit message, the first line of the message would just be: type: subject
<!>
is optional. It must be used for a BREAKING CHANGE.
<body>
is optional. If the exclamation mark is added before the <subject>
, the <body>
must use the format BREAKING CHANGE: <body>
.
+----------→ <type>: Must be one of:
│ feat, fix, style, refactor,
│ docs, style, test, chore
│ Append with ! if its a BREAKING CHANGE.
│
│ +-----→ <scope>: Optional context for the commit subject.
│ │ Alternatively, make the subject more
│ │ specific.
│ │
│ │ +--→ <!>: Indicates a BREAKING CHANGE that
│ │ │ requires a new major semantic version.
│ │ │ Can be part of commits of any `type`.
│ │ │
│ │ │ +--→ <subject>: The commit summary in present
│ │ │ │ tense. Starts with a capital
│ │ │ │ letter. Doesn't end in a
│ │ │ │ period.
⎡‾‾⎤⎡‾‾‾‾‾‾‾⎤│: ⎡‾‾‾‾‾‾‾‾‾‾‾‾⎤
feat(options)!: Add hat wobble
BREAKING CHANGE: Added the "wobble" option,
using the hattip module as a dependency.
Requires Node.js v12 or later. Fixes #3
⎣⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎽⎦
│
│
+----------→ <body>: A longer version of the commit summary.
Can contain multiple paragraphs.
If the commit relates to a Github issue,
the body MUST include a reference to the
issue number, e.g. "Issue #2" or
"Fixes #2". If the commit is a breaking
change, the body MUST use the format
"BREAKING CHANGE: <description>".
The <type>
part of the commit message MUST be one of the following:
feat
: new feature for the user, not a new feature for a build scriptfix
: bug fix for the user, not a fix to a build scriptstyle
: code formatting like missing semicolons, etc.; no production code changerefactor
: refactoring production code like renaming a variabledocs
: documentation changestest
: test suite changes like adding missing tests, refactoring tests; no production code changechore
: misc changes like tooling changes (updating grunt tasks), etc.; no production code change
Important Note: A single commit can only use one <type>
, which means if a commit covers multiple types
, it must be refactored into multiple atomic commits.
TLDR; If you don’t know what scope to use, don’t use one.
Scope is not as rigidly defined as <type>
. It can be anything that helps a developer reading the commit message to understand the context of the commit subject. Alternatively, just make the subject more specific.
Here’s some scopes that could be used:
twig.js
: Twig.js code A code changes that affects the Twig.js half of the codebase, but not any of the Twing code. For example:fix(twig.js): Fix options handling of extensions
twing
: Twing code A code changes that affects the Twing half of the codebase, but not any of the Twig.js code. For example:fix(twing): Fix parameters to new TwingFunction calls
clean_id
: A code change that affects a particular Drupal filter, function or tag. For example:feat(clean_id): The clean_id filter now outputs unique IDs