从git存储库导出版本号 [英] deriving version numbers from a git repository

查看:252
本文介绍了从git存储库导出版本号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个构建系统,它使用svn ID作为VM构建器设备的输入,需要五位数字。当我从git构建时,我一直在伪造这通过计数在git repo的提交的数量。这是唯一的工作: - /我想知道:

we have a build system that uses the svn ID as an imput to a VM builder appliance that required a five digit number. When I build from git I have been faking this by counting the number of commits in the git repo. This only sort-of-works :-/ I'm tyring to figure out:


  • 如何获得一个唯一的5位数字git repo。

推荐答案

您正在寻找 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存储库导出版本号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆