Git 流程发布分支和标签 - 带或不带“v”前缀

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21639437/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 17:42:44  来源:igfitidea点击:

Git flow release branches and tags - with or without "v" prefix

gitnaming-conventionsgit-flow

提问by friederbluemle

I have seen multiple contradicting definitions on various git flow related websites. Is there an official recommendation or single source of truth?

我在各种与 git flow 相关的网站上看到了多个相互矛盾的定义。是否有官方推荐或单一事实来源?

Branches: release-1.2.3or release-v1.2.3

分行:release-1.2.3release-v1.2.3

Tags: 1.2.3or v1.2.3

标签:1.2.3v1.2.3

采纳答案by TimWolla

Well, basically it is a matter of preference, but I prefer the version with the v, as Semverdoes it that way and I try to follow that specification as close as possible to get a sane versioning.

好了,基本上是偏好的问题,但我更喜欢版本的v,因为Semver不这么认为,我要尽量遵循规范尽可能接近得到一个理智的版本。

It also makes filtering for those Tags easier, as you can press vand then the TAB-key for autocompletion: This will list all the tags (and maybe a few branches), whereas there are several digits a tag could start with.

它还可以更轻松地过滤这些标签,因为您可以按v,然后按 -TAB键进行自动完成:这将列出所有标签(可能还有一些分支),而标签可以以几个数字开头。



See also: Is there a standard naming convention for git tags?

另请参阅:git 标签是否有标准命名约定?

回答by VonC

Since v stands for version, tags are generally named vX.Y.Z, with X.Y.Z following Semantic Versioning 2.0.0.

由于 v 代表版本,标签通常被命名为 vX.YZ,其中 XYZ 遵循Semantic Versioning 2.0.0

This allows for branches X.Y.Z to co-exist with those tags, without having to deal with error message like "fatal: Ambiguous object name" (as in "Ambiguous Names with GIT?").

这允许分支 XYZ 与这些标签共存,而无需处理诸如“致命:模糊对象名称”之类的错误消息(如“带有 GIT 的模糊名称?”)。

Note that the tags for Git itself have recently been "adapted" for a surprising reason: see "Code version change “rules”".

请注意,Git 本身的标签最近出于一个令人惊讶的原因进行了“改编”:请参阅“代码版本更改“规则””。

回答by Pier

https://semver.org/#is-v123-a-semantic-version

https://semver.org/#is-v123-a-semantic-version

Is “v1.2.3” a semantic version?No, “v1.2.3” is not a semantic version. However, prefixing a semantic version with a “v” is a common way (in English) to indicate it is a version number. Abbreviating “version” as “v” is often seen with version control. Example: git tag v1.2.3 -m "Release version 1.2.3", in which case “v1.2.3” is a tag name and the semantic version is “1.2.3”.

“v1.2.3”是语义版本吗?不,“v1.2.3”不是语义版本。然而,在语义版本前加上“v”是一种常用的方式(英语)来表示它是一个版本号。将“version”缩写为“v”经常出现在版本控制中。示例:git tag v1.2.3 -m "Release version 1.2.3",在这种情况下,“v1.2.3”是标签名称,语义版本是“1.2.3”。