You are currently viewing A Great Introduction to Semantic Versioning and How does it work?

A Great Introduction to Semantic Versioning and How does it work?

Semantic Versioning

In this article, we will see what is semantic versioning, why it is required, and how it is used.

What is Semantic versioning?

Semantic versioning is also know as semver is one of the most widely adopted versioning systems. It is a simple set of rules and requirements, that dictate how version numbers are assigned and incremented.

Why should we learn?

In today’s world of web development, new packages, modules, plugins, and libraries are being created every single day. All of them at some point in time undergo a change and it is crucial to keep a semantic historical track of those changes. Let’s face it without any guidelines version numbers are essentially useless for dependency management. This is where semantic versioning helps. By using it, it becomes easy to communicate your intentions to users of your software.

How does it work?

A semantic version is of the format “X.Y.Z”, X stands for the major version, Y stands for the minor version and Z stands for the patch. For example, angular version 6.1.2 indicates the major version 6, minor version 1, and patch version 2. And the real question is when do we bump up the different version numbers? Obviously, we can’t increment the version by a random number.

Rules of Versioning

  1. When a fixed bug and the code stays backward-compatible, you increase the patch version. Ex : 1.1.1 to 1.1.2
  2. When you add new functionality but the code will still be backward compatible, you increase the minor version.
  3. But this time you also reset the patch version to 0. Ex: 1.1.1 to 1.2.0
  4. When you make changes and the code is no more backward compatible, you increase the major version. In addition to that you have to reset the minor and patch version to 0. For example 1.1.1 to 2.0.0.
READ ALSO  How does GitHub Co-Pilot Works and Why Should we use it?

This semantic version increment will help the users make decisions regarding the projects. Now, let’s discuss a few more points on versioning.

Important Points

  • The semantic versioning always starts with 0.1.0, that is because you never start with a patch on a brand-new package.
  • 0.y.z (a major version of zero) is used for initial development.
  • When the code is production ready, you increase to version 1.0.0.
  • At any point in time, even the simplest of changes has to be done with an increase in the version number.


That is pretty much how semantic versioning works. If you’re working with NPM, you are going to see semantic versioning being used for dependencies. So, I would say there is definitely a responsibility both as a developer and as a user. As the creator of the package is your duty to update the appropriate version based on the change you make. As a user, it is my responsibility to keep track of the changes and make necessary connections in my project when I update the package to the latest version.

Alright, I hope that you now have a better understanding of what is semantic versioning and why is so important to update it correctly especially if you write packages that are used by others.

Leave a Reply