Semantic Versioning

We created numbers like 1.0.0 and 1.0.1 for releases and hotfixes when we worked on Git Flow. What do these numbers represent, and why do we use them?
These numbers represent the version number of the product we put out in the world. We use them becaus…


This content originally appeared on Zell Liew and was authored by Zell Liew

We created numbers like 1.0.0 and 1.0.1 for releases and hotfixes when we worked on Git Flow. What do these numbers represent, and why do we use them?

These numbers represent the version number of the product we put out in the world. We use them because we’re following a best practice called Semantic Versioning.

When we use Semantic Versioning, developers will know whether a change will break their code. The numbers give a clue to the kind of changes that have occurred.

Many popular projects use Semantic Versioning. Examples are React and Vue.

Understanding Semantic Versioning

A semantic version has three numbers. The rightmost number is a patch version.

Patch Versions

Patch versions are used for bugfixes. There are no functionality changes. (That’s why we use a patch version when we released a hotfix in the previous lesson).

When you increase a new patch, you increase the rightmost number by 1. From 1, you increase it to 2, then to 3, and so on.

If your patch number is 9, when you increase the patch version again, you increase it to 10, then 11, then 12, and so on. (There are no limits to the numbers)

A patch version is the rightmost number

Minor versions

The second number is called the minor version number. It is used when you release new functionality in your project.

When you increase the minor version, you also increase it by one. But when you increase the minor version, you must reset the patch version to zero.

A minor version is the second number

Major versions

The leftmost number is a major version. When you increase the major version, you tell people that there are backward-incompatible changes. People may experience breakage if they use the next version.

When you increase the major version number, you reset both patch version and minor versions.

A major version is the leftmost number

Pre-releases

If you want to create a pre-release (like an alpha or beta version), you can add a -, followed by the words alpha or beta.

There are no hard and fast rules for pre-releases, so you can name them anything you want. Usually, we use alpha or beta, followed by a number, like alpha1.

Starting a project

Most people start projects with 0.1.0. When you’re ready to release the project to the public, you increase the version to 1.0.0.


This content originally appeared on Zell Liew and was authored by Zell Liew


Print Share Comment Cite Upload Translate Updates
APA

Zell Liew | Sciencx (2018-09-28T00:00:00+00:00) Semantic Versioning. Retrieved from https://www.scien.cx/2018/09/28/semantic-versioning/

MLA
" » Semantic Versioning." Zell Liew | Sciencx - Friday September 28, 2018, https://www.scien.cx/2018/09/28/semantic-versioning/
HARVARD
Zell Liew | Sciencx Friday September 28, 2018 » Semantic Versioning., viewed ,<https://www.scien.cx/2018/09/28/semantic-versioning/>
VANCOUVER
Zell Liew | Sciencx - » Semantic Versioning. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2018/09/28/semantic-versioning/
CHICAGO
" » Semantic Versioning." Zell Liew | Sciencx - Accessed . https://www.scien.cx/2018/09/28/semantic-versioning/
IEEE
" » Semantic Versioning." Zell Liew | Sciencx [Online]. Available: https://www.scien.cx/2018/09/28/semantic-versioning/. [Accessed: ]
rf:citation
» Semantic Versioning | Zell Liew | Sciencx | https://www.scien.cx/2018/09/28/semantic-versioning/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.