简体   繁体   中英

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.

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. 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)? 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?


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. 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; 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 ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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