40

我可以发誓有一种方法可以将本地忽略文件保留在 hg 存储库中,即功能类似于 .hgignore 的文件,但未检入存储库。例如,如果使用不同的 IDE,这可用于忽略对 IDE 项目文件的更改。我很难找到它是如何完成的。有人记得细节吗?

4

3 回答 3

52

就是我一直在寻找的。

将以下内容添加到 repo 的 .hg/hgrc 中:

[ui]
ignore = /path/to/repo/.hg/hgignore

并在其旁边创建一个新文件 .hg/hgignore。这个新文件将不被跟踪,但与此特定工作副本的版本化 .hgignore 文件的工作方式相同。(不幸的是 /path/to/repo 位,但在从 repo 的子目录中调用 'hg' 时必须使其工作。)

于 2009-06-15T15:21:55.353 回答
20

在 3.5 版中,设置部分ignore下的属性ui会更改全局忽略文件。要添加要忽略的其他文件,请遵循Jeroen Dierckx的建议并设置属性以获得与添加到存储库中ignore.local相同的效果。.git/info/excludegit

[ui]
ignore = .hgignore
ignore.local = .hg/hgignore
于 2015-08-13T19:05:07.877 回答
2

只需制作一个 .hgignore 文件并将 .hgignore 添加到 .hgignore 文件本身。

于 2009-06-15T15:08:48.943 回答