Basic Usage
To calculate and set the next semantic version for unreleased changes:How It Works
For semantic versioning<MAJOR>.<MINOR>.<PATCH>, git-cliff analyzes conventional commits:
fix:commits → incrementPATCH(e.g., 1.0.0 → 1.0.1)feat:commits → incrementMINOR(e.g., 1.0.0 → 1.1.0)- Breaking changes (commits with
!orBREAKING CHANGE:) → incrementMAJOR(e.g., 1.0.0 → 2.0.0)
Example
If you have version1.0.0 and committed:
1.1.0.
Getting the Version Number
Print the calculated next version to stdout without generating a changelog:Extract Version from Context
You can also extract the bumped version from the JSON context:Bump to Specific Version Type
Override the automatic bump calculation by specifying the version component:When to Use Specific Bumps
Major bump: When making incompatible API changesComplete Release Workflow
Here’s a complete workflow for creating a release with version bumping:Tag Prefixes and Suffixes
git-cliff supports tag prefixes and pre-release identifiers:Version with Prefix
Pre-release Versions
Zero-Based Versioning
When working with versions like0.x.y or 0.0.x, you may want to preserve the leading zero even for breaking changes.
Default Behavior
Preserving Zero-Based Versions
Configure custom bump rules in yourcliff.toml:
Tag Pattern Matching
The next version is validated against thetag_pattern regex in your configuration:
Example with Custom Pattern
Version Bumping Examples
Patch Release (Bug Fixes)
Minor Release (New Features)
Major Release (Breaking Changes)
Pre-release Workflow
Combining with Other Options
Bump and Save to File
Bump with Specific Range
Bump with Custom Template
Bump and Prepend
Practical Workflows
Automated Release Script
CI/CD Integration
Monorepo Package Release
Troubleshooting
No Version Change
If--bumped-version returns empty or the version doesn’t change:
Wrong Version Calculated
Verify your commit messages follow Conventional Commits:Tag Prefix Not Preserved
Ensure yourtag_pattern matches your tag format:
See Also
- Basic Usage - Core git-cliff commands
- CLI Arguments - Complete argument reference
- Bump Configuration - Configure version bumping behavior
- Conventional Commits - Commit message convention