linuxlab.io
Tutorials▾
  • Linux & networking
    File system, processes, TCP/IP, BGP and OSPF
    →
  • Terraform & IaC
    HCL, state, plan/apply on a LocalStack sandbox
    →
  • Git & GitHub
    Object model, plumbing, branching, GitHub Actions
    →
All tutorials →
PricingAboutSign inCreate account
/
Intro
Lessons
Footer
linuxlab-TutorialsPricingAboutPrivacy & cookies
Copyright © 2026 LinuxLab. All rights reserved.
linuxlab.io
Tutorials▾
  • Linux & networking
    File system, processes, TCP/IP, BGP and OSPF
    →
  • Terraform & IaC
    HCL, state, plan/apply on a LocalStack sandbox
    →
  • Git & GitHub
    Object model, plumbing, branching, GitHub Actions
    →
All tutorials →
PricingAboutSign inCreate account
/
  • Introduction
  • Chapters
  • How it works
  • Lessons
  • Knowledge base
  • Interview prep
home/git/kb/Everyday workflow/semver

kb/workflow ── Everyday workflow ── beginner

Semantic Versioning (SemVer)

A versioning convention: `MAJOR.MINOR.PATCH`. PATCH is for backward-compatible bug fixes, MINOR for new backward-compatible functionality, MAJOR for breaking changes. Adopted by most libraries.

view as markdownaka: semantic-versioning

SemVer (Semantic Versioning) is a specification by Tom Preston-Werner (GitHub co-founder). Version format: MAJOR.MINOR.PATCH.

What each number means

  • PATCH (1.4.2): backward-compatible bug fixes. Upgrading from 1.4.1 to 1.4.2 fixes a bug and breaks nothing.
  • MINOR (1.4.0): new backward-compatible functionality. Existing code continues to work; something new and optional has appeared.
  • MAJOR (1.0.0): breaking changes. Something is incompatible; an upgrade requires code migration.

When a higher component increases, the lower ones reset to zero:

1.4.2 → 1.4.3   (patch)
1.4.2 → 1.5.0   (minor)
1.4.2 → 2.0.0   (major)

Additional labels

  • 1.4.2-beta.1, 1.4.2-rc.3: pre-release. Sorts before 1.4.2 without a suffix.
  • 1.4.2+20260527.git7c8a1: build metadata. Ignored in comparisons.

Sort order: 1.4.2-alpha.1 < 1.4.2-beta.1 < 1.4.2-rc.1 < 1.4.2 < 1.4.3.

0.x.y versions

While major is 0, SemVer does not apply strictly. The version is "unstable": breaking changes may appear even in minor bumps. This is the "promise to make no promises". Many projects stay at 0.x for years because they do not want to take on SemVer obligations.

Moving to 1.0.0 means: "the API is public; I commit to SemVer." It does not mean "production-ready". It means backward compatibility is now policy.

Connection to Conventional Commits

With conventional-commits, SemVer is selected automatically:

Commits since last releaseNew version
Only fix: / chore: / docs:PATCH
At least one feat: (no BREAKING)MINOR
At least one BREAKING CHANGE: or !MAJOR

Tools such as semantic-release, release-please, and standard-version do this automatically: they read the commits, compute the next version, create a git tag, and update CHANGELOG.md.

Common mistakes

  • "My patch broke someone's code." If a patch breaks a user, it is not a patch; it is a major. A patch must be backward-compatible.
  • "I rewrote the internals, so it is PATCH." If the external behavior did not change: yes, PATCH. If it did change: minor or major. Internal rewrites alone do not determine the bump level.
  • "I use ^ in package.json." ^1.4.2 means "any 1.x.y ≥ 1.4.2". This works because SemVer promises compatibility within a major. If the library author violates SemVer, ^ will let you down.

Pitfalls

  • Pre-1.0 is awkward for users. If people already depend on your library, moving to 1.0 gives them guarantees. Staying at 0.x for decades is an anti-pattern.
  • Major bumps are expensive. Users must migrate. If your library has an active ecosystem, plan deprecation periods and give people a year to transition.
  • CalVer is an alternative to SemVer. Format: 2026.05.0 (year.month.release). Used by Ubuntu, pip, and JetBrains. No compatibility promises; it is simply a timestamp. Do not confuse it with SemVer.

§ команды

bash
git tag -a v1.4.2 -m "release 1.4.2"

Create an annotated tag for release 1.4.2 (without -a you get a lightweight tag)

bash
git describe --tags

Show the nearest tag and the number of commits since it

bash
npx semantic-release

Automatically determine the version, create a tag, update CHANGELOG

§ см. также

  • tagTagA named pointer to a commit. Two kinds: lightweight (a file with a SHA in `refs/tags/`) and annotated (a separate object in `objects/` with author, date, and optional signature). For releases, use annotated.
  • conventional-commitsConventional CommitsA commit message format: `<type>(<scope>): <subject>`. Enables automatic changelog generation and semver bump selection at release time. The standard dates from 2018 and is supported by most release tooling.
  • commit-cmdgit commitCaptures what is in the index as a new commit object and moves the current branch to that commit. Without arguments it opens an editor for the message; the most common form uses `-m`.
Footer
linuxlab-
Copyright © 2026 LinuxLab. All rights reserved.
Tutorials
Pricing
About
Privacy & cookies