如何使git描述使用SEMVER兼容标签
我希望我的git Dricesd Dricesd
Invocation仅使用REFS 符合语义版本。 为了保持简单,目前,我不在乎其他选择 (就像仅注释的标签一样,分支,候选人,...)。
示例:
我已经标记了1.1.1
(semver兼容)的早期/旧提交, 最近使用my-Software-2.2.2
的提交 以及Some-random-tag
的更新一个。 我希望我的git Dricesd
调用仅考虑1.1.1
标签。
这里的主要困难, 似乎是按照其名称限制标签的方法基于 globs , 不发条。
I want my git describe
invocation to use only refs
that conform to semantic versioning.
To keep it simple, for now, I do not care about other options
(like annotated tags only, branches, candidates, ...).
Example:
I have tagged an early/old commit with 1.1.1
(semver compatible),
a more recent commit with my-software-2.2.2
,
and an even newer one with some-random-tag
.
I want my git describe
invocation to only consider the 1.1.1
tag.
The main difficulty here,
seems to be that the way to limit the tags by their name is based on globs,
not regex.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我到目前为止找到的最佳选项:
因为
- 匹配
标志仅支持原始地球,不完整的正则
此检查仅考虑表单
integer.integer.integer.integer
的非常简单的semver。忽略其他有效的有效,例如:
2.0.0-rc.2
2.0.0-rc.1
1.0.0.0-beta
1.0.0-alpha+001
1.0.0+20130313144700
1.0.0-beta+exp.sha.5114f85
1.0.0.0+21af26d3- -117B344092BD
The best option I found so far:
Because the
--match
flag only supports primitive globs,not full regex,
this check only considers very simple semver's of the form
integer.integer.integer
,disregarding other valid ones, like:
2.0.0-rc.2
2.0.0-rc.1
1.0.0-beta
1.0.0-alpha+001
1.0.0+20130313144700
1.0.0-beta+exp.sha.5114f85
1.0.0+21AF26D3—-117B344092BD
另一个选择是使用(核心GIT独立)GO工具:
git-descripe-semver
。
示例用法:
An other option is to use the (core git independent) Go tool:
git-describe-semver
.sample usage: