Git tag release version?

The preliminary version MAY be indicated by adding a dash and a series of dotted identifiers immediately after the patch version. Examples: 1.0.0-alpha, 1.0.0-alpha.1, 1.0.0-0.3.7, 1.0.0-x.7.z.92.

semver.org

In order to eliminate ambiguity, what would be the “right” way to tag a release commit (commit from the main branch)?

Some ideas

v1.7.2-release v1.7.2-master v1.7.2-prod v1.7.2-official v1.7.2-stable 

github.com/antirez/redis/tags

+5
source share
1 answer

You can choose a policy similar to Git itself (see Its tags in the GitHub repository ):

 v1.7.2-rc0 v1.7.2-rc1 v1.7.2-rc2 v1.7.2-rc3 v1.7.2 

The idea (as described in the section Choosing the Right Version Numbering Policy ) might be as follows:

" master branch will be the one containing the code marked as production ready at the moment," master should always be compiled.
The code in the master branch must have an even tag number.

For the version number, it will be created using the git description command, as it is a kind of de facto standard.

See canonical version numbers with Git :

 git describe –tags –long 

This gives you a type string (in the case of one of my projects)

 2.1pre5-4-g675eae1 

which is formatted as

 {last reachable tag name}-{# of commits since that tag}-#{SHA of HEAD} 

This gives you a “canonical version number (spelling corrected) that monotonically increases when committed and is unique to multiple development repositories. If everyone were on the same HEAD, it would return the same value. If we all use the same and same last tag, but have different commits, SHA will be different.

You can strive to only have version numbers on master , such as

 {last reachable tag name}-0-#{SHA of HEAD} 

(i.e. only commit with tags)

But the idea is that this kind of version number (tag + SHA) is completely unique.

+8
source

Source: https://habr.com/ru/post/1403797/


All Articles