gpt4 book ai didi

git - 从 git 存储库中获取版本号

转载 作者:太空狗 更新时间:2023-10-29 14:40:48 25 4
gpt4 key购买 nike

我们有一个构建系统,它使用 svn ID 作为 VM 构建器设备的输入,需要一个五位数的数字。当我从 git 构建时,我一直在通过计算 git repo 中的提交次数来伪造这一点。这只是一种工作:-/我很想弄清楚:

  • 如何从 git 存储库中获取唯一的 5 位数字。

最佳答案

您正在寻找 git describe :

The command finds the most recent tag that is reachable from a commit. If the tag points to the commit, then only the tag is shown. Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object and the abbreviated object name of the most recent commit.

$ git describe master
v1.10-5-g4efc7e1

关于git - 从 git 存储库中获取版本号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3603981/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com