Mercurial .hgignore:有关如何忽略单个文件的一些问题
我的存储库中有一个特定的文件,libraries/database.php,我需要忽略它。但是,我无法获取识别该文件的语法 - 我尝试过 **/libraries/**/database.php
和 libraries/database.php
glob 和正则表达式中的 ^.libraries/database.php
,但它们都不起作用。我应该怎么办?
There's a particular file in my repository, libraries/database.php, that I need ignored. However, I can't get the syntax to recognize the file - I've tried **/libraries/**/database.php
and libraries/database.php
in glob, and ^.libraries/database.php
in regex, but neither of them work. What should I do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
经过几个小时遵循此处的所有建议和网上找到的其他建议后,我发现我在 .hgignore 中总是做得正确,但 .hgignore 不会忽略当前由 Mercurial 跟踪的文件。
您必须这样做
,否则将文件添加到 .hgignore 不会生效。
然后上面的就可以工作了。
After hours of following all the suggestions here and others found on the web, I found out that I was always doing it right in .hgignore, but .hgignore will not ignore files that are currently being tracked by mercurial.
You must do
Or adding the file to .hgignore doesn't take affect.
Then the above will work.
那会起作用的。
但是,坦率地说,我自己一直发现 .hgignore 语法有点晦涩。我真的不明白 glob 会匹配什么,不会匹配什么。
That will work.
But, frankly, I've always found the .hgignore syntax to be a little obscure myself. I don't really understand what glob will and won't match.
来自 Mercurial 快速入门指南:
“Mercurial 将在您的存储库的根目录包含一组要在文件路径中忽略的 glob 模式和正则表达式”,
您的 .hgignore 是否位于正确的位置?
所以
应该有效。
From the mercurial QuickStart guide:
"Mercurial will look for a file named .hgignore in the root of your repository which contains a set of glob patterns and regular expressions to ignore in file paths"
is your .hgignore at the right place ?
So
should work.