
Product
Socket for Jira Is Now Available
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.
git-conventional-commits
Advanced tools
[!TIP] Also have a look at Git Conventional Commits Cheat Sheet
See CHANGELOG.md.
npx git-conventional-commits <command>
[!TIP] Add the help flag
-hto any command to list all possible options.
init [options] create a config file template `git-conventional-commits.yaml`
version [options] determine version from conventional commits
changelog [options] generate changelog from conventional commits
commit-msg-hook [options] <commit-msg-file> check for conventional commit message format
npx git-conventional-commits initgit-conventional-commits.yaml to your needsExample git-conventional-commits.yaml
---
convention:
# commitMessageRegexPattern: ^(?<type>\w+)(?:\((?<scope>[^()]+)\))?(?<breaking>!)?:\s*(?<description>.+)
commitTypes:
- feat # Commits that add, adjust or remove a feature to/of/from the API or UI
- fix # Commits that fix a bug of a preceded `feat` commit
- refactor # Commits that rewrite/restructure your code, however do not change any behaviour
- perf # Commits that are special `refactor` commits or that improve performance
- style # Commits that do not affect the meaning (white-space, formatting, missing semicolons, etc.)
- test # Commits that add missing tests or correcting existing tests
- build # Commits that affect build components like build tool, ci pipeline, dependencies, project version, etc.
- ops # Commits that affect operational components like infrastructure, deployment, backup, recovery, etc.
- docs # Commits that affect documentation only
- chore # Miscellaneous commits e.g. modifying `.gitignore`
- merge
commitScopes: []
releaseTagGlobPattern: v[0-9]*.[0-9]*.[0-9]*
changelog:
commitTypes:
- feat
- fix
- perf
- merge
includeInvalidCommits: true
commitScopes: []
commitIgnoreRegexPattern: "^WIP "
headlines:
feat: Features
fix: Bug Fixes
perf: Performance Improvements
merge: Merges
breakingChange: BREAKING CHANGES
commitUrl: https://github.com/qoomon/git-conventional-commits/commit/%commit%
commitRangeUrl: https://github.com/qoomon/git-conventional-commits/compare/%from%...%to%?diff=split
issueRegexPattern: "#[0-9]+"
issueUrl: https://github.com/qoomon/git-conventional-commits/issues/%issue%
convention
commitMessageRegexPattern custom regex pattern for commit messages
^(?<type>\w+)(?:\((?<scope>[^()]+)\))?(?<breaking>!)?:\s*(?<description>.+)commitTypes an array of expected commit types
["feat", "fix", "docs", "style"]featureCommitTypes an array of commit types that define a feature.
["feat"]commitScopes an array of expected commit scopes
["ui", "database"]releaseTagGlobPattern glob pattern to filter for release tags
[0-9]+\.[0-9]+\.[0-9]+)*changelog
commitTypes filter commits by type
convention.commitTypes plus
merge commits["feat", "fix", "merge"]commitScopes filter commits by scopes
convention.commitScopes["ui"]includeInvalidCommits include commits without valid type: default: true
commitTypes will be removed from changelogcommitIgnoreRegexPattern filter commits by commit subject regex
^WIP headlines a map of headline identifier and actual headline
changelog.commitTypes plus
breakingChange Breaking Changes Section{ "feat": "Features", "fix": "Bug Fixes", "breakingChange": "BREAKING CHANGES"}{ "feat": "Features", "fix": "Bug Fixes", "merge": "Merges", "breakingChange": "BREAKING CHANGES"}commitUrl a URL template for generating Markdown links to repository commits
%commit% commit hash placeholderhttps://github.com/qoomon/git-conventional-commits/commit/%commit%issueUrl a URL template for generating Markdown links to an issue tracker
%issue% issue id placeholderhttps://jira.example.org/browse/%issue%issueRegexPattern regex pattern to find issue IDs
[A-Z]{3,}-\\d+To automatically validate commit messages, a git hook can be used in the commit-msg stage.
The hook can be created either manually or using the pre-commit framework.
.pre-commit-config.yaml file in the root directory of your repository with following content.
repos:
- repo: https://github.com/qoomon/git-conventional-commits
rev: <RELEASE_TAG>
hooks:
- id: conventional-commits
pre-commit framework pip install pre-commitpre-commit install -t commit-msgcd <repository-path>mkdir .git-hooksgit config core.hooksPath .git-hookstouch .git-hooks/commit-msg && chmod +x .git-hooks/commit-msg.git-hooks/commit-msg with your favorite editor and paste following script
#!/bin/sh
# fix for windows systems
PATH="/c/Program Files/nodejs:$HOME/AppData/Roaming/npm/:$PATH"
npx git-conventional-commits commit-msg-hook "$1"
.git-hooks/commit-msg to repository[!IMPORTANT] Whenever you clone your repository with git hooks you need to enable git hooks once again
git config core.hooksPath .git-hooks
[!TIP] You can document types/scopes inline via YAML comments, and they will show up in the hook error output.
git describe --tags --match=<glob> --no-abbrev, using the releaseTagGlobPattern.--exclude=<glob>-*[!NOTE] A breaking change is defined by a commit message that contains
!in the subject, orBREAKING CHANGE/BREAKING CHANGESin the body. A feature is defined by a commit message that contains one of thefeatureCommitTypes(by default:[feat]). Anything else will become a patch version update.
| Commit type | Current version | Version change |
|---|---|---|
| Breaking change | 0.y.z | minor (0.y+1.z) |
| Breaking change | x.y.z (x >=1) | major (x+1.y.z) |
| Feature | any | minor (x.y+1.z) |
| Anything else | any | patch (x.y.z+1) |
git-conventional-commitsnpx git-conventional-commits versiongit commit -am'build(release): bump project version to <version>'npx git-conventional-commits changelog --release <version> --file 'CHANGELOG.md'
git commit -am'docs(release): create <version> changelog entry'git tag -a -m'build(release): <version>' '<version-prefix><version>'git pushIf you have a large existing repo with no release tags e.g. v1.0.0, or if you want the first changelog to be tidy, you need to create a release tag first.
git tag -a -m'build(release): 0.0.0' 'v0.0.0'git push origin v0.0.0
This way npx git-conventional-commits will only consider commits based on the commit the release tag is pointing at.npm installnpm testnpm loginnpm publishFAQs
git conventional commits util
We found that git-conventional-commits demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.