在Git中,如何确定当前的修订版本是什么? [英] In Git, how do I figure out what my current revision is?

查看:73
本文介绍了在Git中,如何确定当前的修订版本是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只想知道我当前的版本号是什么.

I just want to know what my current version number is.

推荐答案

版本号"是什么意思?通常用一个版本号标记一个提交然后使用

What do you mean by "version number"? It is quite common to tag a commit with a version number and then use

$ git describe --tags

标识当前的HEAD w.r.t.任何标签.如果您想知道当前HEAD的哈希值,则可能需要:

to identify the current HEAD w.r.t. any tags. If you mean you want to know the hash of the current HEAD, you probably want:

$ git rev-parse HEAD

或用于简短修订哈希:

$ git rev-parse --short HEAD

这样做通常就足够了:

$ cat .git/refs/heads/${branch-master}

但这不可靠,因为可能包装了裁判.

but this is not reliable as the ref may be packed.

这篇关于在Git中,如何确定当前的修订版本是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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