Skip to content
Foxipa
Code Completion 4 Challenges

Complete the Git commands: Git Sparse-Checkout: Work with a Selected Working-Tree Subset

Create a disposable repository containing at least three directories with tracked files. Initialize sparse-checkout in cone mode, select two directories, verify the selected and omitted paths, add another directory, and inspect the selection with `list`. Then disable sparse-checkout and confirm the full working tree is restored. Reinitialize in non-cone mode, select files with patterns, and repeat the inspection. Deliberately create a temporary divergence by restoring or creating a tracked file outside the sparse selection, run `reapply`, and observe the result. Finally, repeat the setup once with `--sparse-index`. Explain why none of these operations delete the omitted files from Git history and why sparse-checkout is different from partial clone.

Advanced ~6 min read

Challenge 1

Complete the Git command to select a subset of the working tree.

bash Your answer
git  init --cone

Press Ctrl⌘Enter to check your answer

Challenge 2

Complete the Git command to select a subset of the working tree.

bash Your answer
git  list

Press Ctrl⌘Enter to check your answer

Challenge 3

Complete the Git command to select a subset of the working tree.

bash Your answer
git  set src/app docs

Press Ctrl⌘Enter to check your answer

Challenge 4

Complete the Git command to select a subset of the working tree.

bash Your answer
git  set --cone src/app docs

Press Ctrl⌘Enter to check your answer