0

I'm using git sparse-checkout to have only the files I'm interested in on disk. I'm unable to figure out how to match multiple patterns.

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

Checkout all .tf files

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

Checkout all .tf.json files

How can I checkout all files that fit both patterns at once? I've tried

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"

But none of these options match either pattern

1 Answer 1

2

I had misread the docs. Each pattern is a new argument, so the following works

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

From the docs on set:

Write a set of patterns to the sparse-checkout file, as given as a list of arguments following the set subcommand.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.