忽略以后对Mercurial中的文件所做的更改,但仍会跟踪它 [英] Ignore future changes to a file in Mercurial, but still track it
问题描述
可能重复:
Mercurial:如何忽略对跟踪文件的更改
Possible Duplicate:
Mercurial: How to ignore changes to a tracked file
我在Mercurial存储库中有一个文件,希望将其作为示例配置文件,但是在开发该文件时,我想对其进行特定的更改,例如数据库密码,而不希望被跟踪.我尝试将文件添加到.hgignore
,但是Mercurial仍然注意到修改.
I have a file in a Mercurial repository that I want to have stand as an example configuration file, but while I'm developing it I want to make specific changes to it I don't want tracked, like a database password. I tried adding that file to .hgignore
, but Mercurial still notices modifications.
我可以在Mercurial存储库中跟踪"文件,但是忽略该文件将来的本地更改而不将其从存储库本身中删除吗?
Can I have a file "tracked" in a Mercurial repository, yet ignore future local changes to that file without removing it from the repository itself?
推荐答案
我不认为该功能存在(不过希望可以看到其他人的选择选项:)).我使用的替代方法是将文件检入名为"config.template"的源代码管理中(例如).该应用程序实际上使用了一个名为"config"的文件,然后我通过复制模板文件来创建该文件.然后,确保.hgignore文件中排除了"config"文件,这样您就不会在某个时候不小心签入.
I don't think this capability exists (love to see someone else's answer with an option though :) ). The alternative I've used is to check a file into source control named "config.template" (as an example). The app actually uses a file named "config", which I then create by copying the template file. Then make sure that the "config" file is excluded in the .hgignore file so you don't accidentally check in sometime.
这篇关于忽略以后对Mercurial中的文件所做的更改,但仍会跟踪它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!