Possible Duplicate:
what is the git equivalent for revision number?
I have been using subversion for same time now, and would like to switch to git. Having read the manual I have only one reservation, I use svnversion to get a reference number that is: unique, short, monotonic with respect to time (always increases).
- It must be unique, so I can use it to reproduce the article.
- It must be short, so it is readable, can be used in file-names, page footers, version number displays.
- It must only increase ( monotonic with respect to time ), so any one can compare the age of two articles, without knowing the age (date).
Constraint: If we can get a branch ID than the above requirements only have to be met for articles on the same branch. (Branch ID can be anything that can be compared for identity, “is this the release branch?”.
[The word article is used here to represent a computer program, document or something else that is generated from the content of the revision control system.]
As fork0 stated there’s no such equivalent for non-linear histories, you can anyway execute this to get the number of commits for the current branch:
This is what one of my team mates use for generating a build number to be used in the build scripts.