Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git revision number in source code documentation

Tags:

git

comments

I've seen in several projects that developers include something like $Revision$ in source code documentation. I think they are macros or environment variables for some tool but I do not know how to work with them.

I am interested on adding this feature to my next project. I normally use TextMate, git and doxygen. Any suggestions?

like image 675
elitalon Avatar asked Aug 10 '11 19:08

elitalon


2 Answers

Yes: suggestion: don't do it.
Keyword expansion could be done with gitattribute filter, as presented in "Git equivalent of subversion's $URL$ keyword expansion", but this introduce metadata within the data, which usually makes merge much more complex that they actually are.

You can see in this (lengthy) answer on "What are the basic clearcase concepts every developer should know?" the all debate on "Embedded Version Numbers - Good or Evil?".
Unless you have a good merge manager in order to ignore those special values, you get a "Merge Hell".
And with Git, as detailed in "How does Git solve the merging problem?", the merge is quite basic. No fancy merge manager.

like image 188
VonC Avatar answered Sep 20 '22 12:09

VonC


$Revision:$ (the ':' is required) is used by RCS and CVS. Some other systems have similar features, but it seems that the more modern ones do not.

like image 43
Keith Thompson Avatar answered Sep 22 '22 12:09

Keith Thompson