相关疑难解决方法(0)

解释gitignore模式匹配

我有以下目录树:

> #pwd is the repo   
> tree -a
.
??? .git
?   |.....
??? .gitignore
??? README.md
??? f1.html
??? f2.html ... and some more html
??? images
?   ??? river.jpg
>
Run Code Online (Sandbox Code Playgroud)

我也有以下内容.gitignore:

> cat .gitignore
*
!*.html
!images/*.*
>
Run Code Online (Sandbox Code Playgroud)

我希望images目录中的所有文件都包含在repo中.但那并没有发生.我在gitignore中使用以下内容工作:

*
!*.html
!images*
!*.jp*g
Run Code Online (Sandbox Code Playgroud)

这里发生了什么?是否有一种万无一失的测试gitignore的方法.我检查了文档.这是它不理解的一点(这是在模式格式标题下):

否则,Git将模式视为适合fnmatch(3)使用FNM_PATHNAME标志消耗的shell glob:模式中的通配符与路径名中的/不匹配.例如,"Documentation/*.html"匹配"Documentation/git.html",但不匹配"Documentation/ppc/ppc.html"或"tools/perf/Documentation/perf.html".

regex git gitignore

20
推荐指数
1
解决办法
2万
查看次数

Git忽略所有缩小的后缀文件

我目前有类似的东西:

javascripts/
    plugin.js
    plugin.min.js

stylesheets/
    style.css
    style.min.css
Run Code Online (Sandbox Code Playgroud)

如何让所有人.gitignore忽略所有minified(.min)文件?会有类似的**/*.min.*工作吗?

git gitignore

11
推荐指数
2
解决办法
8986
查看次数

标签 统计

git ×2

gitignore ×2

regex ×1