我的 .hgignore 文件出了什么问题? (没有什么被忽略)
我的 .hgignore 文件的内容如下,并且没有任何内容被忽略:
^nbproject$
^.htaccess$
^my.conf$
/media/images/captcha/.*\.jpg$
我尝试将该文件放置在主项目存储库文件夹和工作目录中。
怎么了?请帮忙。
The content of my .hgignore file as follow and NOTHING is being ignored:
^nbproject$
^.htaccess$
^my.conf$
/media/images/captcha/.*\.jpg$
I tried to place the file in the main project repository folder and in the working directory.
What's wrong? Please help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您不需要
syntax:regexp
——这是默认设置。您确实需要将文件放在
.hg
文件夹上方的目录中,因此布局如下所示:您还需要转义文件路径中的所有点。试试这个:
您确实需要确保尚未添加和/或提交文件。
.hgignore
文件不会覆盖 add,它只会阻止您使用通配符添加内容以及在 .hgstatus 中看到被忽略(未添加)的内容。如果您已经添加了这些文件,则需要hg忘记
它们,然后它们才会被忽略。如果没有任何效果,请尝试以下操作:
并发布输出。
You don't need
syntax:regexp
-- that's the default.You do need to put the file in the directory above the
.hg
folder, so the layout looks like:You also need to escape all the dots in your file paths. Try this:
You do need to make sure you haven't already added and/or committed the files. The
.hgignore
file does not override add, it only prevents you from adding stuff using wildcards and from seeing ignored (non-added) stuff in .hgstatus. If you've already added these files you need tohg forget
them before they'll be ignored.If nothing's working try this:
and post the output.
将此行添加到文件顶部:
至于 .hgignore 文件应该放在哪里,按照 https://www.mercurial-scm.org/wiki/.hgignore
Add this line to the top of the file:
As for where the .hgignore file should go, per https://www.mercurial-scm.org/wiki/.hgignore
对于这种基本的忽略,您可能应该使用更简单的 glob 语法(使用
syntax: glob
指令来明确)。另外,从技术上讲,您应该转义“.”,因为它们是特殊的正则表达式字符,但由于“.”,您很幸运。恰好匹配任何字符,包括文字“.”。然而,像这样的混乱只是强调了我关于使用更简单的 glob 机制的观点。You should probably use the simpler glob syntax for such basic ignores (with the
syntax: glob
directive to be explicit). Also, you should technically be escaping the '.'s since they are special regexp characters, but you are lucky since '.' happens to match any character, including the literal '.'. Confusion like this simply underlines my point about using the simpler glob mechanism, however.另请注意,如果
.hgignore
文件以 UTF-8 BOM 开头,则hg
无法处理该文件。由于这是 Windows 记事本的默认行为,因此您可能需要注意这一点。Also note that
hg
can't deal with the.hgignore
file if it starts with a UTF-8 BOM. Since this is the default behaviour of Windows Notepad, you might need to watch out for that.