tags:

views:

156

answers:

1

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?

+8  A: 

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

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.

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).


Of course, you can always count your commits

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

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.

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.

VonC