查找给定提交的标记信息 [英] Find tag information for a given commit

查看:82
本文介绍了查找给定提交的标记信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在Git中获得与提交编号关联的标签?

对于我通常使用类似v1.1.0的标签进行标记。在我的构建脚本中,我创建了一个包含当前git信息的fwVersion.c文件。目前,我已经在文件中提交和分支信息,但我想添加标签。



这可能吗?


<解决方案检查 git describe 的文档。它找到了一个给定提交(它是一个指向提交祖先的标记)的最近标记,并用该标记描述提交。



如果你只想知道提交是否被一个标签指向,那么你可以检查输出:

  git describe --exact -match< commit-id> 


Is there a way to get the tag associated with a commit number in Git?

For releases I usually tag with something like v1.1.0. During my build script I am creating a fwVersion.c file that contains the current git info. Currently, I have commit, and branch info in the file, but I would like to add the tag.

Is this possible?

解决方案

Check the documentation for git describe. It finds the nearest tag to a given commit (that is a tag which points to an ancestor of the commit) and describes that commit in terms of the tag.

If you only want to know if the commit is pointed to by a tag then you can check the output of:

git describe --exact-match <commit-id>

这篇关于查找给定提交的标记信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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