4

We are planning to move to GIT from SVN in nearest future. Currently our software version format is {year}.{major}.{minor}.{revision}, for example 2010.3.2.32465. {revision} part is filled automatically by build script, so it is very simple to find exact version of code for any build. Off course we can use GIT revision for same purpose, but I am wondering that something like 2010.1.2.ce04503acce2452af1c3 will look ugly and less human-readable then SVN revision numbers. Assuming that we have some main central repository,

  • Is it possible to track some numeric version like "commit number" for that repository?
  • Is it possible to track it automatically from build scripts?
  • What are best practices for version numbers at GIT?

Any thoughts? Thanks.

Victor Haydin
  • 3,518
  • 2
  • 26
  • 41
  • Using the hash tag of the revision has another problem: you cannot tell which version is the most recent simply be looking at the tags and ordering them. – tonio Jan 05 '11 at 08:49
  • Yes, that's right. But we need to move to GIT, because we have a lot of branches and tags and that is painful situation for SVN. – Victor Haydin Jan 05 '11 at 08:52
  • @tonio Actually this problem is not so important, if I would have some numeric identifier and can find revision for it, it is very easy to order them by commit date. That is applicable for me. – Victor Haydin Jan 05 '11 at 08:55

1 Answers1

3

You can use git describe to get the identification of the commit you base your release on.

See http://www.kernel.org/pub/software/scm/git/docs/git-describe.html

It provides the branch name, the number of commits and the sha id of the commit. This way, you have an ordering of the different releases, and full identification.

tonio
  • 10,355
  • 2
  • 46
  • 60