git 令人困惑的 .gitignore 语法
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2906633/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Confusing .gitignore syntax
提问by tmslnz
I was reading http://www.kernel.org/pub/software/scm/git/docs/v1.7.10/gitignore.htmland the 6 points used to explain the ignore patterns seem to be describing a custom variant of a glob search syntax. I am more familiar with Mercurial, which allows to explicitly ignore via glob or regex patterns, no questions asked.
我正在阅读http://www.kernel.org/pub/software/scm/git/docs/v1.7.10/gitignore.html用于解释忽略模式的 6 点似乎在描述 glob 的自定义变体搜索语法。我更熟悉 Mercurial,它允许通过 glob 或 regex 模式明确忽略,没有问题。
- Is there any similar functionality in Git?
- Can anyone point me to some more exhaustive reference than the Git man page?
- Git 中是否有类似的功能?
- 谁能给我指点比 Git 手册页更详尽的参考资料?
Best,
t
最好,
Ť
采纳答案by Andrea Salicetti
Not exactly. It can be used a bash-like syntax where you can specify something like this:
不完全是。它可以使用类似 bash 的语法,您可以在其中指定如下内容:
*tmp_*~
*tmp_*~
which is the same as the regExp: .*tmp_.*~
与 regExp 相同: .*tmp_.*~
Hope this will help you!
希望能帮到你!
回答by Cascabel
There is no built-in way of excluding by regex. If there were, you'd see it on the man page.
正则表达式没有内置的排除方法。如果有,您会在手册页上看到它。