Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Git track Versions?

I am a Git newbee with UNIX SCCS and Microsoft Visual SourceSafe experience.

In SCCS, each file has a version (I%), which is made of Release (%R), Level (L%), Branch (%B), and Sequence (S%). %I is equal to R%.%L.B%.%S, okay? These are referred to as ID Keywords.

The purpose is you insert these ID Keywords in the source code before checking them in, then when you check them out for read-only (not to change), It’ll convert them to their version number. For example:

printf(“Version s\n”, “%I“);

...will become,

printf(“Version %s\n”, “1.4.6.2”);

Which will print,

Version 1.4.6.2

SCCS keeps track of versions on a file-by-file basis and increments them each time they’re checked in.

Is there anything close to that in Git?

like image 754
PalaDolphin Avatar asked Mar 02 '10 20:03

PalaDolphin


1 Answers

As discussed in the SO question "To put the prefix ? to codes by Git/Svn", Git has no RCS keyword expansion.

The closest Git command would be git describe, to have some kind of commit reference.

But it is generally not a good idea mixing meta-data (i.e. data "version id" about data "the file") with data (the files).
If you really need this kind of information, a separate special file listing your other regular file, with their associated version id is more practical.

Even ClearCase, which has similar notions than SCS in term of per-file branch and sequence, does not have embedded version numbers: See Embedded Version Numbers - Good or Evil?.

like image 57
VonC Avatar answered Oct 04 '22 03:10

VonC