我可以知道提交的修订号吗? [英] Can i know the revision number of a commit?

查看:85
本文介绍了我可以知道提交的修订号吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以通过svn info等命令在svn中看到版本号,但是在git中我只能看到sha对象名,有什么方法可以知道已经提交了多少版本?

I can see revision number in svn by commands like svn info, but in git i can only see sha object names, is there any way to know how many revisions have been commited?

推荐答案

git describe 将是最接近这种信息的方式,正如其他SO问题

git describe would be the closest way to get that kind of information, as suggested in this other SO question

[torvalds@g5 git]$ git describe parent
v1.0.4-14-g2414721




即我的父分支的当前头是以 v1.0.4 为基础的,但由于它有几个提交, describe增加了额外提交(14)和提交本身的缩写对象名称( 2414721 )。

i.e. the current head of my "parent" branch is based on v1.0.4, but since it has a few commits on top of that, describe has added the number of additional commits ("14") and an abbreviated object name for the commit itself ("2414721") at the end.

额外提交的数量是 git log v1.0.4..parent

散列后缀为 -g + 7-char 缩写父级的提示提交( 2414721b194453f058079d897d13c4e377f92dc6 )。

The number of additional commits is the number of commits which would be displayed by "git log v1.0.4..parent".
The hash suffix is "-g" + 7-char abbreviation for the tip commit of parent (which was 2414721b194453f058079d897d13c4e377f92dc6).






当然,您可以随时数你的提交

git shortlog -s -n
  135  Tom Preston-Werner
  15  Jack Danger Canty
  10  Chris Van Pelt




-s 选项将所有提交消息压缩为提交数量, -n 选项按提交次数对列表进行排序。

The -s option squashes all of the commit messages into the number of commits, and the -n option sorts the list by number of commits.

这个命令对于 changelogs ,因为您可以轻松地转储每个人所做的所有更改。

还有其他一些简洁选项:

-e 会附加电子邮件,你可以用 -w 来控制列宽。

检查 manpage 以获取更多信息。

This command could also be useful for changelogs, since you could easily dump all the changes each person has done.
There’s a few other neat options:
-e will append emails, and you can control columns widths with -w.
Check out the manpage for more information.

这篇关于我可以知道提交的修订号吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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