Versioning using GIT revision
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 ar开发者_运维问答e best practices for version numbers at GIT?
Any thoughts? Thanks.
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.
精彩评论