配置 – 我应该避免使用git跟踪具有单独历史记录的单个文件,例如在/ var/named中吗?

在2012年1月Randal Schwartz发表了一个名为Introduction to Git的演讲,我非常喜欢,但我对他的警告感到困惑,他不会使用git跟踪不相关或单独历史记录的单个文件.

Page 4 of his slides包含以下要点. . .

But not for…

  • Tracking file permissions and ownership
  • Tracking individual files with separate history
  • Making things painful

. . .这是他说的,大概4分钟后:

It is not optimized for any kind of metadata about the files. It does not, it does not, track file permissions or file ownership. That is not its job. It’s managing source files, and sources don’t have owners, sources don’t have permissions. Sources are used in recipes to build the real thing that you are going to deploy. So git does not have technology about that. People have tried to build structures on top of it to do that, with some degree of success, but really let’s look at basically what git is meant for and not what people are building on top of it.

It’s also not meant for tracking individual files with unrelated or separate history. For example, you may think, “Oh, I really like this. I want to track all my et cetera with it. But et cetera is really a bunch of separate, unrelated files. You wouldn’t be doing branching and merging. . . add this change to that change and eventually want to back out both of them at the same time. It doesn’t really work that way. So it’s not good for individual files.

I still use RCS to track individual files in my /etc. It’s really fast, it’s cheap, and I can get back to the data I need to. It’s also not optimized for making things painful. Ok? It’s designed to be easy and stuff.

就个人而言,我没有计划用git跟踪我的/ etc,但我最近开始使用git来跟踪/ var / named(BIND配置).鉴于Randal上面要说的,我应该为此停止使用git吗?有没有缺点,我不期待的问题,一个陷阱?到目前为止,一切都按照我的预期正常工作,我没有遇到任何问题,但由于上面的警告,我实际上犹豫是否开始使用git来跟踪/ var / named.

我受scm_track_enabledscm_track_enabled功能的影响,该功能说“启用了一个触发器,当执行添加,编辑或同步事件时,版本控制对/ var / lib / cobbler的所有更改.这可用于恢复到以前的数据库版本,生成RSS提要,或用于其他审计或备份目的.git是推荐用于此功能的SCM.“我对/ var / named使用git非常类似于此.

(作为旁注,我从来没有使用过RCS而且无法想象学习它,即使它很容易,当我已经对git有一个很好的理解.)

具体来说,我想知道如何使用git来跟踪/ var / named,但我欢迎使用git跟踪类似目录的最佳实践答案.

最佳答案
这正在陷入“非常主观”的领域.但…

我认为使用git跟踪这类事情并没有错.是的,它是为跟踪相互关联的源文件的大型复杂集合而构建的.这并不意味着它不仅适合跟踪小型非相关文件集合.

就个人而言,我使用etckeeper在我的服务器上使用git后端跟踪/ etc.效果很好.当从Ubuntu的apt repo安装时,它带有很好的钩子到apt,所以它会自动启动与每个新的软件包安装一致的提交.非常方便.

无论如何,试一试,它不会伤害任何东西,如果你最终想要转换到另一个版本控制系统,有很多可用的迁移工具.

转载注明原文:配置 – 我应该避免使用git跟踪具有单独历史记录的单个文件,例如在/ var/named中吗? - 代码日志