要将 ./ node_modules / 文件夹和 .idea 文件夹忽略为.hgignore文件,以便我不想跟踪它们。
目前我的.hgignore文件中有以下规则。
*.orig
*./node_module/
*.idea/
*.rej
*~
*.o
tests/*.err
但是hg status
上的中止错误。
答案 0 :(得分:1)
嗯,hg help hgignore
指向hg help patterns
。我无法更好地解释它:
Mercurial accepts several notations for identifying one or more files at a
time.
By default, Mercurial treats filenames as shell-style extended glob
patterns.
Alternate pattern notations must be specified explicitly.
Note:
Patterns specified in ".hgignore" are not rooted. Please see 'hg help
hgignore' for details.
To use a plain path name without any pattern matching, start it with
"path:". These path names must completely match starting at the current
repository root.
To use an extended glob, start a name with "glob:". Globs are rooted at
the current directory; a glob such as "*.c" will only match files in the
current directory ending with ".c".
The supported glob syntax extensions are "**" to match any string across
path separators and "{a,b}" to mean "a or b".
(...)
Plain examples:
path:foo/bar a name bar in a directory named foo in the root
of the repository
path:path:name a file or directory named "path:name"
还有其他方法可以使用正则表达式指定路径,也可以在可用的命令行帮助中进行说明。
所以,使用像
这样的东西node_module/**
.idea/**
或
path:node_module
path:.idea
如果您引用了整个.hgignore,那么使用默认的glob模式匹配。
答案 1 :(得分:-1)
最后我找到了小费。这是怎么回事。 您需要指定以下内容 node_modules / 和 .idea / 文件夹。 N.B>是指终端。
触摸.hgignore 纳米.hgignore
添加以下内容
^node_modules/
^.idea/
完成!