Challenge - 5 Problems
Sparse Checkout Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
Sparse checkout initialization output
You run these commands in a new Git repository:
What will be the output or result of the last command?
git initgit remote add origin https://example.com/repo.gitgit config core.sparseCheckout trueecho "docs/" > .git/info/sparse-checkoutgit pull origin mainWhat will be the output or result of the last command?
Attempts:
2 left
💡 Hint
Sparse checkout allows you to check out only parts of the repo you want.
✗ Incorrect
Enabling sparse checkout and specifying 'docs/' in the sparse-checkout file causes Git to fetch and check out only that folder's contents.
🧠 Conceptual
intermediate1:30remaining
Understanding sparse-checkout file format
Which of the following lines in the
.git/info/sparse-checkout file will include all files inside the 'src' directory and its subdirectories?Attempts:
2 left
💡 Hint
Trailing slash means directory and all contents.
✗ Incorrect
The pattern 'src/' includes the directory and all its contents recursively. 'src/*' includes only immediate children, not subdirectories.
🔀 Workflow
advanced2:30remaining
Steps to enable sparse checkout on an existing repo
You have cloned a large repository fully. Now you want to enable sparse checkout to keep only the 'config/' folder locally. Which sequence of commands correctly achieves this?
Attempts:
2 left
💡 Hint
You must enable sparse checkout, set the patterns, then update the working tree.
✗ Incorrect
Enabling sparse checkout, writing the pattern, and running 'git read-tree -mu HEAD' updates the working directory to match the sparse patterns.
❓ Troubleshoot
advanced2:00remaining
Sparse checkout not working as expected
You enabled sparse checkout and set the sparse-checkout file to include 'app/'. But after pulling, you still see all files checked out. What is the most likely cause?
Attempts:
2 left
💡 Hint
Sparse checkout must be explicitly enabled in Git config.
✗ Incorrect
If core.sparseCheckout is false, Git ignores the sparse-checkout file and checks out the full repo.
✅ Best Practice
expert3:00remaining
Efficient sparse checkout with Git's built-in commands
Which command sequence uses Git's built-in sparse-checkout commands to initialize sparse checkout and set it to only the 'frontend/' and 'backend/' folders?
Attempts:
2 left
💡 Hint
Use the new sparse-checkout commands with cone mode for simplicity.
✗ Incorrect
The 'git sparse-checkout init --cone' enables cone mode, and 'git sparse-checkout set' sets the folders to include efficiently.