What is semantic versioning?
BeginnerConceptBranching, versioning & releases
Answer
In one line: Semantic versioning (SemVer) is a version format MAJOR.MINOR.PATCH — like 2.4.1 — where each number tells users what kind of change the release contains.
The rules:
- MAJOR (
2.x.x) — increase when you make breaking changes (old clients or integrations may stop working). - MINOR (x.
4.x) — increase when you add new features in a backward-compatible way. - PATCH (x.x.
1) — increase for backward-compatible bug fixes.
When you increase one number, reset the numbers to its right: 2.4.1 → new feature → 2.5.0; breaking change → 3.0.0.
Extras:
- Pre-release:
3.0.0-beta.1,3.0.0-rc.2. - Build metadata:
2.5.0+build.457(ignored when comparing versions). 0.x.y— initial development; anything can change.
Why it matters in DevOps:
- Dependency safety —
^2.4.1in npm means "any 2.x version from 2.4.1", trusting that minor/patch updates won't break you. - Clear communication — users know whether an upgrade is safe.
- Artifact and image tags —
orders:2.5.0is meaningful;orders:latestis not. - Helm charts and APIs are versioned the same way.
Automating versions:
- Conventional Commits (
feat:,fix:,feat!:/BREAKING CHANGE:) let tools like semantic-release or release-please decide the next version automatically and generate changelogs.
Example: commit messages fix: handle empty cart → release 1.8.3; feat: add wishlist → 1.9.0; feat!: remove v1 API → 2.0.0.
Tip for interviews: explain what each number means and mention automated versioning from commit messages.
More on Branching, versioning & releases
What is a branching strategy, and why does it matter?BeginnerWhat is trunk-based development?BeginnerWhat is GitFlow, and when would you use it?BeginnerWhat is a Git tag, and how are tags used in releases?BeginnerWhat is a pull request, and what makes a good code review?BeginnerWhat is branch protection?Beginner