A simple convention for conveying semantic versioning to both humans and automated systems via commit messages
Use a character prefix, followed by a space, to inform your consumers about the intent of the work.
~ Fix typo in response from parser
! faux-util: Delete deprecated options
^ Add automated data validation for user inputs Previously, user inputs underwent manual validation, leading to occasional errors and data inconsistencies. Users had to carefully review inputs before submission, which was time-consuming and prone to oversight. Now, the system checks inputs against predefined criteria in real-time, flagging discrepancies and providing error messages. This ensures data integrity and reduces errors, improving overall system reliability.
Fix 404 credit links in CONTRIBUTING
acme-tool: Remove superfluous semicolons
The Commits With Character specification draws inspiration from Conventional Commits, in that it also serves the purpose of adding semantic significance to a commit message. However, it distinguishes itself by endorsing and expanding upon the commit guidelines outlined in the original Git Book, thereby steering clear of commit categorisation.
If you know Semantic Versioning, you know Commits With Character.
This simple addition is for projects that do not need the full power of Changesets (which is highly recommended for complex team projects), are happy to drive a changelog and release from commit messages, but would rather not have the overhead of Conventional Commits.
The Semantic Release tool can be easily configured to use Commits with Character. Here's an example configuration file:.releaserc.yamlplugins:
# Extracts commits starting with ~, ^, or !
- path: '@semantic-release/commit-analyzer'
parserOpts:
headerPattern: '^([!^~])(?: (.*):)? (.*)$'
headerCorrespondence:
- type
- scope
- subject
# The type can be a glob pattern so the characters need to be escaped.
releaseRules:
- release: patch
type: "\\~"
- release: minor
type: "\\^"
- release: major
type: "\\!"
# Generates release notes using Major, Minor, and Patch sections.
- path: '@semantic-release/release-notes-generator'
parserOpts:
headerPattern: '^([!^~])(?: (.*):)? (.*)$'
headerCorrespondence:
- type
- scope
- subject
preset: conventionalcommits
presetConfig:
types:
- hidden: false
section: Major
type: '!'
- hidden: false
section: Minor
type: '^'
- hidden: false
section: Patch
type: '~'
# Uses pnpm to bump and publish the release.
- path: '@semantic-release/exec'
prepareCmd: 'pnpm version ${nextRelease.version} --git-tag-version=false'
publishCmd: 'pnpm publish --no-git-checks'
# Saves the release notes to GutHub's Releases page.
- '@semantic-release/github'
# Writes to the CHANGELOG.md file.
- path: '@semantic-release/changelog'
changelogFile: CHANGELOG.md
changelogTitle: '# Changelog'
# Commits the changes with a "vX.Y.Z" message.
- path: '@semantic-release/git'
assets:
- CHANGELOG.md
- package.json
message: |
v${nextRelease.version}
[skip ci]Release command
pnpx --package semantic-release@25 \
--package conventional-changelog-conventionalcommits@9 \
--package @semantic-release/changelog@7 \
--package @semantic-release/git@11 \
--package @semantic-release/exec@7 semantic-release
Whilst it is not recommended, if you really feel the need to categorise every commit with a prefix, here's some suggestions you can use for all non-consumer affecting commits.
| Prefix | Description |
|---|---|
= | A source code change that doesn’t fix a bug, doesn’t add a feature, doesn’t change performance, or doesn't change the meaning of the code (comments, white-space, formatting, missing semi-colons, etc). |
? | Add missing tests or correct existing tests. |
% | Documentation only changes. |
$ | Changes that affect the build system or external dependencies (development dependencies), or changes to CI configuration files and scripts. Can be used for general project maintenance tasks. |
> | Release and merge commits. |
< | Revert commits. |