源代码文档中的 git 修订号

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7016300/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 05:48:35  来源:igfitidea点击:

git revision number in source code documentation

gitcomments

提问by elitalon

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.

我在几个项目中看到开发人员$Revision$在源代码文档中包含了类似的内容。我认为它们是某些工具的宏或环境变量,但我不知道如何使用它们。

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

我有兴趣将此功能添加到我的下一个项目中。我通常使用 TextMate、git 和 doxygen。有什么建议?

回答by VonC

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.

是:建议:不要这样做。
关键字扩展可以使用 gitattribute 过滤器完成,如“ Git 等效于 subversion 的 $URL$ 关键字扩展”中所述,但这会在数据中引入元数据,这通常会使合并比实际情况复杂得多。

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.

您可以在这个(冗长的)回答中看到“每个开发人员应该知道的基本 clearcase 概念是什么?”关于“嵌入式版本号 - 好还是坏?”的所有辩论。
除非你有一个好的合并管理器来忽略这些特殊值,否则你会得到一个“合并地狱”。
使用 Git,如“ Git 如何解决合并问题?”中所述,合并非常基础。没有花哨的合并管理器。

回答by Keith Thompson

$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.

$Revision:$(':' 是必需的)由 RCS 和 CVS 使用。其他一些系统具有类似的功能,但似乎更现代的系统没有。