Git version number in source code documentation

I have seen in several projects that developers include something like $Revision$ in the source code documentation. I think these are macros or environment variables for some tool, but I don’t know how to work with them.

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

+6
source share
2 answers

Yes: suggestion: do not do this.
Keyword expansion can be accomplished using the gitattribute filter, as presented in the Git equivalent of the subversion $ URL $ " keyword extension , but this introduces metadata into the data, which usually makes the merge much more complex than it actually is.

You can see in this (long) answer to What are the basic concepts of transparency that every developer should know? "All discussions on the topic" Embedded version of the Number - good or evil? "
If you don't have a good merge manager to ignore these special values, you get a "Merge Hell".
And with Git, as described in How can Git solve the merge problem? ", merging is pretty simple. There is no merge manager.

+8
source

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

+1
source

Source: https://habr.com/ru/post/894751/


All Articles