Semantic Versioning (SemVer 2.0.0), Package Dependency Ranges & Git Tagging Runbook
The definitive guide to software release management, SemVer 2.0.0 rules, and automated package publishing. Learn how package managers evaluate caret (^), tilde (~), and wildcard ranges, how to prevent breaking changes in minor releases, and how Conventional Commits drive automated CI/CD Git tags and changelog generation.
1. The SemVer 2.0.0 Triad: MAJOR.MINOR.PATCH Rules
X.Y.Z (MAJOR.MINOR.PATCH). Each component communicates a specific degree of risk to consumers:| Version Component | Increment Condition | API Compatibility Impact | Risk Level for Consumers | Copy |
|---|---|---|---|---|
| MAJOR (X.0.0) | Incompatible, breaking API modifications or contract removals | Breaking Change | High (Requires migration code, testing, or schema adjustments) | |
| MINOR (X.Y.0) | New backwards-compatible functionality or feature additions | Backwards-Compatible Feature | Low (Safe to upgrade automatically; no code changes required) | |
| PATCH (X.Y.Z) | Backwards-compatible bug fixes and internal performance tuning | Bug Fix / Security Patch | Minimal (Recommended immediate update for stability and security) |
2. Package Dependency Range Mechanics: Caret (^), Tilde (~) & Wildcards
| Range Syntax | Specification Rule | Allowed Update Boundaries | Example Resolution (^2.4.1) | Copy |
|---|---|---|---|---|
| Caret (^) | Locks the left-most non-zero segment; allows minor & patch bumps | >= X.Y.Z < (X+1).0.0 | Allows up to 2.99.99; rejects 3.0.0 (breaking) | |
| Tilde (~) | Locks major and minor segments; allows only patch increments | >= X.Y.Z < X.(Y+1).0 | Allows up to 2.4.99; rejects 2.5.0 | |
| Exact (No prefix) | Locks package to one exact immutable release version | === X.Y.Z | Only installs 2.4.1; zero variance permitted | |
| Wildcard (* / x) | Accepts any available release within the specified segment | 2.x or * | Unstable in production; should be restricted to development tools |
3. Pre-1.0.0 Zero Major Semantics: Rapid Prototyping & Instability
0.y.z) designates software in initial development. In this phase, anything MAY change at any time, and public APIs should not be deemed stable.
Crucially, package managers treat the caret operator differently in 0.x versions: because the left-most non-zero element is the MINOR version, ^0.2.3 locks the minor version and permits only patch increments (up to 0.2.x), explicitly rejecting 0.3.0. Once a package reaches production maturity and exposes a public API contract, bumping to 1.0.0 is mandatory.# Stable 1.x Release:
"dependency": "^1.2.3" # Resolves 1.2.3 -> 1.9.9 (MINOR bumps permitted)
# Unstable 0.x Release:
"dependency": "^0.2.3" # Resolves ONLY 0.2.3 -> 0.2.9 (Rejects 0.3.0!)
"dependency": "^0.0.3" # Resolves ONLY 0.0.3 (Rejects 0.0.4!)4. Conventional Commits: Driving Automated Versioning in CI/CD
package.json version strings and drafting changelogs is error-prone. Modern release pipelines utilize the Conventional Commits specification to deduce the exact required SemVer bump mathematically from Git history:
โข fix: ... โ Triggers an automatic PATCH bump.
โข feat: ... โ Triggers an automatic MINOR bump.
โข feat!: ... or commit footer BREAKING CHANGE: ... โ Triggers an automatic MAJOR bump.
Automated tools (such as semantic-release, Changesets, and Release Please) inspect commit messages since the last Git tag, calculate the next version, generate Markdown changelogs, and publish package artifacts autonomously.# Triggers PATCH (e.g. 2.7.0 -> 2.7.1)
git commit -m "fix(auth): handle expired JWT tokens gracefully without crash"
# Triggers MINOR (e.g. 2.7.0 -> 2.8.0)
git commit -m "feat(export): add one-click CSV export engine for workspace history"
# Triggers MAJOR (e.g. 2.7.0 -> 3.0.0)
git commit -m "feat(api)!: migrate REST endpoints to GraphQL schema" \
-m "BREAKING CHANGE: /api/v1/users endpoint removed in favor of user query"5. Immutable Git Tagging & Cryptographic Provenance
git tag -s v2.7.0 -m "Release v2.7.0").
Cryptographic GPG or SSH commit signing guarantees provenance, proving that the release was authored by authorized maintainers rather than an impersonated CI bot. Combined with published SHA-256 release checksums, downstream consumers can verify package integrity with mathematical certainty.# Create annotated and GPG-signed tag
git tag -s v2.7.0 -m "Release v2.7.0: 10 new developer tools & history CSV export"
# Push tag to remote origin
git push origin v2.7.0
# Verify signature of an existing release tag
git tag -v v2.7.0Related Free Online Tools
Put these techniques into practice immediately with our privacy-first browser utilities:
Calculate next Patch, Minor, and Major release version increments and test dependency range rules according to SemVer 2.0.0.
Translate cryptic 5-field UNIX crontab schedules into clear plain English sentences with simulated execution run times.
Generate TypeScript Zod runtime validation schemas from sample JSON data with smart string inference and strict object rules.