简体   繁体   English

hg本地忽略

[英]hg local ignore

I could have sworn there was a way to keep a local ignore file in an hg repo, ie a file similar in function to .hgignore, but not checked into the repo. 我本来可以发誓有一种方法可以在hg repo中保留一个本地忽略文件,即一个类似于.hgignore功能的文件,但是没有检入回购。 This could be used to ignore changes to an IDE project file if different IDEs are being used, for example. 例如,如果正在使用不同的IDE,则可以使用它来忽略对IDE项目文件的更改。 I'm having trouble finding how it's done. 我很难找到它是如何完成的。 Does anyone recall the details? 有人回忆起细节吗?

This is what I was looking for. 就是我想要的。

Add the following to the repo's .hg/hgrc: 将以下内容添加到repo的.hg / hgrc中:

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

and create a new file .hg/hgignore beside it. 并在它旁边创建一个新文件.hg / hgignore。 This new file will be untracked, but work the same as the versioned .hgignore file for this specific working copy. 此新文件将不会被跟踪,但与此特定工作副本的版本化.hgignore文件的工作方式相同。 (The /path/to/repo bit is unfortunate but necessary to make it work when invoking 'hg' from within a subdir of the repo.) (/ path / to / repo位是不幸的,但是当从repo的子目录中调用'hg'时它是必要的。)

In version 3.5, setting the ignore property under the ui section changes the global ignore file. 在3.5版中,在ui部分下设置ignore属性会更改全局忽略文件。 To add additional files to be ignored, follow the advice of Jeroen Dierckx and set the ignore.local property to get the same effect as adding to .git/info/exclude in a git repository. 要添加要忽略的其他文件,请遵循Jeroen Dierckx的建议并设置ignore.local属性以获得与在git存储库中添加.git/info/exclude相同的效果。

[ui]
ignore = .hgignore
ignore.local = .hg/hgignore

只需创建.hgignore文件并将.hgignore添加到.hgignore文件中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM