如何使用 git稀疏结帐与多个匹配模式

问题描述 投票:0回答:1

我使用

git sparse-checkout
仅将我感兴趣的文件存储在磁盘上。我无法弄清楚如何匹配多个模式。

git sparse-checkout set --no-cone "**/*.tf"

查看所有

.tf
文件

git sparse-checkout set --no-cone "**/*.tf.json"

查看所有

.tf.json
文件

如何一次检出符合两种模式的所有文件?我试过了

git sparse-checkout set --no-cone "**/*.tf **/*.tf.json"
git sparse-checkout set --no-cone "**/*.tf,**/*.tf.json"
git sparse-checkout set --no-cone "**/*.tf\n**/*.tf.json"

但是这些选项都不符合任何一种模式

git glob sparse-checkout git-sparse-checkout
1个回答
0
投票

我误读了文档。每个模式都是一个新参数,因此以下内容有效

git sparse-checkout set --no-cone "**/*.tf" "**/*.tf.json"

来自set

上的文档:

将一组模式写入稀疏签出文件,如 set 子命令后面的参数列表所示。

© www.soinside.com 2019 - 2024. All rights reserved.