Git标签发布版本? [英] Git tag release version?

查看:804
本文介绍了Git标签发布版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


预发布版本可以通过在修补程序版本后立即追加短划线和一系列点分隔标识符来表示。示例:1.0.0-alpha,1.0.0-alpha.1,1.0.0-0.3.7,1.0.0-x.7.z.92。

semver.org



为了消除歧义,什么是标签释放提交(从主分支提交)的正确方式?

一些想法

  v1.7.2-release 
v1.7.2-master
v1.7.2-prod
v1.7.2-官方
v1.7.2-stable

github.com/antirez/redis/tags

解决方案

您可以选择类似于Git本身的政策(请参阅其在GitHub仓库中的标签):

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

这个想法(如


< p <'code> master '分支将包含在给定时刻标记为生产准备就绪的代码,' master
master '分支中的代码必须有偶数标记号。



对于版本号,它将使用git describe命令创建,因为它实际上是一种标准。




'p>请参阅
规范版本号在GIT



$ p $ git describe -tags -long




这给了你一个字符串(就我的一个项目而言)




  2.1pre5-4-g675eae1 




格式为



  {最后可到达的标签名称} {{自该标签以来提交的数量}  - #{HEAD}的SHA 




这为您提供了一个规范版本号(拼写更正),它通过提交单调递增,并且在多个开发库中是唯一的。如果我们都在同一个HEAD上,它将返回相同的值。如果我们都共享相同的最新标签,但具有不同的提交,SHA将有所不同。

您可以争取 master 只有版本号,例如

  {最后到达标记名称} -0  - #{SHA的头} 

(即标签提交)



但是我们的想法是,这种版本号(标签+ SHA)完全明确。


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.

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

解决方案

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

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.
Code in the ‘master’ branch must have an even tag number.

For the version number, it will be created using the git describe command, since it’s a sort of standard de facto.

See Canonical Version Numbers with Git:

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. If we all share the same most-recent-tag, but have different commits, the SHA will be different.

You can strive for having on master only version numbers like

{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.

这篇关于Git标签发布版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆