简体   繁体   English

获取* next *标签,如git describe但“转发”

[英]Get *next* tag, like git describe but “forwards”

With git describe , I can get information about the latest tag on which my current commit is based, and how far away from it I am. 使用git describe ,我可以获得有关当前提交所基于的最新标签以及与之距离的信息。

I'm looking for a way to, based on the same information, build a semantic version number for a beta-version of the next release. 我正在寻找一种基于相同信息为下一版本的beta版本构建语义版本号的方法。 In other words, given a tree like 换句话说,给定一棵像

A -- B -- C -- D
|              |
v1.2.3         HEAD

Now, git describe can give me something like v1.2.3-4-D - but how do I get to something like v1.2.4-beta or v1.3.0-beta (depending on which segment I say I want to increment)? 现在, git describe可以给我像v1.2.3-4-D -但我怎么得到类似v1.2.4-betav1.3.0-beta (取决于哪段我说我要增加)? Is there some tool built into git to handle this, or do I have to start with git describe and then pass that to something else that can increment for me? git中是否内置了一些工具来处理此问题,还是我必须先从git describe开始,然后将其传递给可以为我增加的其他内容?


The proposed duplicate question does not solve my problem, because it relies on git describe --contains , and that only works if the future tag already exists. 提出的重复问题不能解决我的问题,因为它依赖于git describe --contains ,并且仅在将来的标记已经存在时才有效。 I'm looking for a way to, given the previous tag, infer what the upcoming release version will be , by giving only the current repo state and which part (major/minor/patch) should be incremented. 我正在寻找一种方式,因为以前的标签, 推断出即将发布的版本将是什么,通过只给当前回购的状态,哪部分(主要/次要/补丁)应增加。

The comments seem to indicate that this is not possible with plain git commands; 这些注释似乎表明使用普通的git命令是不可能的。 therefore, I've resorted to use GitVersion which solves exactly the problem I want to solve (albeit using a small yml file on disk to store data about what version, rather than deriving it from git describe ). 因此,我一直使用GitVersion来解决我要解决的问题(尽管在磁盘上使用了一个小的yml文件来存储有关哪个版本的数据,而不是从git describe派生出来)。

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

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