.hgignore 似乎不起作用

发布于 2024-12-17 19:22:20 字数 499 浏览 2 评论 0原文

我的项目根目录中有一个 .hgignore 文件,但它没有执行蹲下操作。当我执行 hg add 时,项目目录中的每个文件都会被添加和跟踪。无论我使用 tortoisehg 还是命令行,我都会得到相同的结果。命令行是我的偏好。这是怎么回事?

我的.hgignore(取自SO上的另一个问题):

# use glob syntax
syntax: glob

*.obj
*.pdb
*.user
*.aps
*.pch
*.vspscc
*.vssscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.cache
*.ilk
*.log
*.lib
*.sbr
*.scc
[Bb]in
[Dd]ebug*/
obj/
[Rr]elease*/
_ReSharper*/
[Tt]humbs.db
[Tt]est[Rr]esult*
[Bb]uild[Ll]og.*
*.[Pp]ublish.xml
*.resharper

I have a .hgignore file in my project's root directory and it's not doing squat. When I do an hg add, every single file in my project directory is being added and tracked. I get the same result whether I use tortoisehg or the command-line. Command-line is my preference. What's going on here?

My .hgignore (taken from another question on SO):

# use glob syntax
syntax: glob

*.obj
*.pdb
*.user
*.aps
*.pch
*.vspscc
*.vssscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.cache
*.ilk
*.log
*.lib
*.sbr
*.scc
[Bb]in
[Dd]ebug*/
obj/
[Rr]elease*/
_ReSharper*/
[Tt]humbs.db
[Tt]est[Rr]esult*
[Bb]uild[Ll]og.*
*.[Pp]ublish.xml
*.resharper

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

幸福还没到 2024-12-24 19:22:20

显然这是文件编码的问题。我正在 Notepad++ 中编辑该文件(尝试了 ANSI 和 UTF-8 编码),并且该文件在编辑时看起来很好。我已经放弃并决定使用命令 notepad .hgignore 重新开始。然后我粘贴了给我带来麻烦的文件内容,所有内容都在一行上,没有中断。我修复了中断,保存了文件,它立即起作用了。

我仍然不确定为什么该文件在 Notepad++ 中看起来很好,但实际上却输出了垃圾。

Apparently it was some issue with the encoding of the file. I was editing the file in Notepad++ (tried ANSI and UTF-8 encodings) and the file looked fine when editing. I had given up and decided to start over by using the command notepad .hgignore. Then I pasted the contents from the file that was giving me trouble and everything was on a single line with no breaks. I fixed the breaks, saved the file and it immediately worked.

I'm still not sure why the file looked fine in Notepad++ but was actually putting out garbage.

野味少女 2024-12-24 19:22:20

glob 匹配语法考虑了路径。您可以切换到 syntax:relglob 作为相对路径名,或者在您的模式中添加 **/ 前缀。

The glob match syntax takes the path into account. You can switch to syntax: relglob for relative pathnames or prefix your patterns with **/.

韬韬不绝 2024-12-24 19:22:20

您可能需要告诉 Mercurial 全局忽略文件所在的位置。我必须在 .hgrc[ui] 部分添加此行才能正常工作。

ignore = ~/.hgignore

You may need to tell mercurial where the global ignore file is located. I had to add this line under the [ui] section of my .hgrc for it to work.

ignore = ~/.hgignore
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文