SyntaxStudy
Sign Up
Git Beginner 7 min read

Semantic Versioning

Semantic Versioning (SemVer) is a widely adopted versioning scheme: MAJOR.MINOR.PATCH. Increment MAJOR for breaking changes, MINOR for new backwards-compatible features, and PATCH for backwards-compatible bug fixes. Pre-release labels like -alpha, -beta, and -rc.1 are also supported.

Example
# Semantic Versioning: MAJOR.MINOR.PATCH
# Example: 2.4.1
#   MAJOR = 2  (breaking API changes)
#   MINOR = 4  (new features, backwards-compatible)
#   PATCH = 1  (bug fixes, backwards-compatible)

# Start at 0.1.0 for initial development.
# Release 1.0.0 when the public API is stable.

# Version progression examples:
# 1.0.0  — first stable release
# 1.0.1  — patch: fix null pointer exception
# 1.1.0  — minor: add CSV export feature
# 1.1.1  — patch: fix CSV encoding bug
# 2.0.0  — major: redesigned API (breaking change)

# Pre-release versions:
# 2.0.0-alpha.1  — early preview, may be unstable
# 2.0.0-beta.3   — feature complete, may have bugs
# 2.0.0-rc.1     — release candidate, almost ready

# Tag these releases in Git:
git tag -a v1.0.0     -m "First stable release"
git tag -a v1.1.0     -m "Add CSV export"
git tag -a v2.0.0-rc.1 -m "Release candidate 1 for v2"

# npm respects SemVer in package.json:
# "^1.0.0"  — accepts 1.x.x (MINOR and PATCH updates)
# "~1.0.0"  — accepts 1.0.x (PATCH updates only)
# "1.0.0"   — exactly this version