Skip to content

Commit abdf40e

Browse files
committed
Merge pull request semver#108 from mojombo/clarify-version-comparisons
Clarify version comparisons
2 parents 62c2005 + 84c9618 commit abdf40e

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

semver.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,22 @@ packages with the same version, but different build metadata are considered to
9292
be the same version. Examples: 1.0.0-alpha+001, 1.0.0+20130313144700,
9393
1.0.0-beta+exp.sha.5114f85.
9494

95-
1. Precedence MUST be calculated by separating the version into major, minor,
96-
patch and pre-release identifiers in that order (Build metadata does not figure
97-
into precedence). Major, minor, and patch versions are always compared
98-
numerically. Pre-release precedence MUST be determined by comparing each dot
99-
separated identifier as follows: identifiers consisting of only digits are
100-
compared numerically and identifiers with letters or hyphens are compared
95+
1. Precedence refers to how versions are compared to each other when ordered.
96+
Precedence MUST be calculated by separating the version into major, minor, patch
97+
and pre-release identifiers in that order (Build metadata does not figure
98+
into precedence). Precedence is determined by the first difference when
99+
comparing each of these identifiers from left to right as follows: Major, minor,
100+
and patch versions are always compared numerically. Example: 1.0.0 < 2.0.0 <
101+
2.1.0 < 2.1.1. When major, minor, and patch are equal, a pre-release version has
102+
lower precedence than a normal version. Example: 1.0.0-alpha < 1.0.0. Precedence
103+
for two pre-release versions with the same major, minor, and patch version MUST
104+
be determined by comparing each dot separated identifier from left to right
105+
until a difference is found as follows: identifiers consisting of only digits
106+
are compared numerically and identifiers with letters or hyphens are compared
101107
lexically in ASCII sort order. Numeric identifiers always have lower precedence
102-
than non-numeric identifiers. Example: 1.0.0-alpha < 1.0.0-alpha.1 <
108+
than non-numeric identifiers. A larger set of pre-release fields has a higher
109+
precedence than a smaller set, if all of the preceding identifiers are equal.
110+
Example: 1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-alpha.beta < 1.0.0-beta <
103111
1.0.0-beta.2 < 1.0.0-beta.11 < 1.0.0-rc.1 < 1.0.0.
104112

105113
Why Use Semantic Versioning?

0 commit comments

Comments
 (0)