What is Semantic Versioning
Version numbering standard MAJOR.MINOR.PATCH
Semantic Versioning (SemVer) — a software version numbering standard in the format MAJOR.MINOR.PATCH, where each part has a specific meaning.
Version structure
- MAJOR (1.x.x) — incompatible API changes
- MINOR (x.1.x) — new functionality with backward compatibility
- PATCH (x.x.1) — backward compatible bug fixes
- Pre-release — 1.0.0-alpha, 1.0.0-beta.1
- Build metadata — 1.0.0+build.123
Rules
- Initial version — 0.1.0
- First stable release — 1.0.0
- When incrementing MAJOR — reset MINOR and PATCH
- When incrementing MINOR — reset PATCH
- Versions are compared left to right
Change examples
- MAJOR: function removal, method signature change
- MINOR: new endpoint addition, new optional parameter
- PATCH: bug fix, performance improvement
Tools
- npm — uses SemVer for packages
- Composer — PHP package manager
- Maven — Java dependencies
- semantic-release — release automation
- commitizen — structured commits
Benefits
- Predictability — clear expectations from updates
- Automation — automatic version determination
- Documentation — changelog from commits
- Compatibility — safe dependency updates