简体   繁体   English

Git标签发布版本?

[英]Git tag release version?

A pre-release version MAY be denoted by appending a dash and a series of dot separated identifiers immediately following 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. 示例:1.0.0-alpha,1.0.0-alpha.1,1.0.0-0.3.7,1.0.0-x.7.z.92。

semver.org semver.org

For the purpose of disambiguation, what would be a "proper" way to tag a release commit (commit from the master 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 github.com/antirez/redis/tags

You can choose a policy similar to Git itself (see its tags in the GitHub repo ): 您可以选择类似于Git本身的策略(请参阅GitHub仓库中的标记 ):

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

The idea (as described in Choosing a good version numbering policy ) can go along the lines of: 这个想法(如选择一个好的版本编号政策中所述 )可以遵循以下方式:

The ' master ' branch will be the one containing the code marked to be production ready in a given moment, ' master ' must be always compilable. ' master '分支将包含标记为在给定时刻生产就绪的代码,' master '必须始终可编译。
Code in the ' master ' branch must have an even tag number. master ”分支中的代码必须具有偶数标记号。

For the version number, it will be created using the git describe command, since it's a sort of standard de facto. 对于版本号,它将使用git describe命令创建,因为它是一种标准的事实。

See Canonical Version Numbers with Git : 请参阅Git的Canonical Version Numbers

git describe –tags –long

This gives you a string like (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 is monotonically increasing by commits, and unique across multiple repositories of development. 这为您提供了一个“规范版本号”(拼写更正),它通过提交单调增加,并且在多个开发存储库中是唯一的。 If we're all on the same HEAD, it will return the same value. 如果我们都在同一个HEAD上,它将返回相同的值。 If we all share the same most-recent-tag, but have different commits, the SHA will be different. 如果我们都共享相同的最新标记,但具有不同的提交,则SHA将是不同的。

You can strive for having on master only version numbers like 您可以努力获得仅限master版本号

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

(ie tagged commits only) (即仅标记提交)

But the idea is that this kind of version number (tag + SHA) is completely unambiguous. 但是这个想法是这种版本号(标签+ SHA)是完全明确的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM