.hgignore 放在哪里?
我想知道 .hgignore 文件放在哪里;在主存储库中还是每个程序员都应该将其放在他的克隆副本中?
请澄清。谢谢。
I'm wondering where to put .hgignore file; in the main repository or each programmer should have it on his cloned copy?
Please clarify. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您应该将该文件放在存储库的根目录中。
请参阅:
它说:
可以通过将这些文件列在工作根目录的 .hgignore 文件中来忽略它们目录。 .hgignore 文件必须手动创建。它通常置于版本控制之下,以便设置将通过推送和拉取传播到其他存储库。
另一个优点是,您可能正在处理多个项目。每个都有自己的一组要忽略的文件模式。例如,处理 Visual Studio 项目或简单的 C++ 项目或 Python 项目。 这可以确保要忽略的模式与项目相关。
但是,您可能不希望在每个忽略文件中复制这些模式。在这种情况下,Mercurial 配置文件可以引用一组每用户或全局忽略文件。
~/.hgrc1 中的全局忽略文件示例
:
~/.hgignore 中:
1 在 Windows 上:
%USERPROFILE%\ Mercurial.ini
、~
指 Windows 上的%USERPROFILE%
。You should put the file at the root of your repository.
See :
It says:
These files can be ignored by listing them in a .hgignore file in the root of the working directory. The .hgignore file must be created manually. It is typically put under version control, so that the settings will propagate to other repositories with push and pull.
Also another advantage is that, you might be working on multiple projects. Each having it's own set of pattern of files to ignore. For example, working on a Visual Studio project or a simple C++ project or a Python project. This ensures that patterns to ignore are relevant to the project.
How ever, you may not want to replicate these patterns in every ignore files. In such a case Mercurial configuration file can reference a set of per-user or global ignore files.
Example for global ignore files
in ~/.hgrc1:
in ~/.hgignore:
1 On Windows:
%USERPROFILE%\mercurial.ini
,~
refers to%USERPROFILE%
on Windows.除了主存储库之外,我从未在任何地方见过它。
I've never seen it anywhere but the main repository.
如果存储库中没有 .hgignore 文件,您将如何忽略 .hgignore 来忽略它;P
说真的......它可能应该在存储库中,因为要忽略的文件是特定于存储库的;用户当然可以在其 .hgrc 中指定的文件中另外指定自己的忽略
How are you going to ignore the .hgignore without an .hgignore file in the repositry to ignore it ;P
Seriously.. it should probably be in the repository, since the files to be ignored are respositry-specific; a user can of course specify their own ignores additionally in a file specified in their .hgrc
您可以在
~/.hgrc
目录中拥有一个全局目录,也可以在其中拥有一个特定于项目的目录项目的根目录
you can have a global one inside your
~/.hgrc
directory or a project specific one insidethe project's root directory
它位于存储库的顶部文件夹中。它不是针对个人忽略,而是针对项目范围的忽略(即适用于每个人)。然而,通常开发人员会添加例如他们最喜欢的编辑器的温度。文件到该文件 - 不会伤害任何人。
如果您想忽略其他人可能不想忽略的内容,请将其放入 ~/.hgrc 中的个人忽略中。
It belongs in the top folder of the repository. It is not meant for personal ignores but for project-wide ignores (i.e. applying for everyone). However, usually developers will add e.g. their faviourite editor's temp. files to that file - doesn't hurt anyone.
If you want to ignore something others probably do NOT want to ignore, put it in your personal ignore in ~/.hgrc.