Skip to content
Foxipa
Code Completion 4 Challenges

Complete the Git commands: Git read-tree: Read and Merge Trees into the Index

In a disposable repository, create a base commit and a second commit. Use an alternate `GIT_INDEX_FILE` to read the base tree, prove the index entries with `git ls-files --stage`, empty the alternate index, and read the tree again under a prefix. Then use `--index-output` to produce a separate index file. Verify `--dry-run` leaves the index unchanged. Finally, create two divergent commits from a common ancestor and use `git read-tree -m BASE OURS THEIRS` with an alternate index; inspect the resulting stage 1/2/3 entries with `git ls-files --stage`. Repeat a non-conflicting two-tree merge and, separately, a `-u` operation in a disposable worktree to observe the working-tree boundary.

Advanced ~6 min read

Challenge 1

Complete the Git command to read tree data into the index.

bash Your answer
git  -m BASE OURS THEIRS

Press Ctrl⌘Enter to check your answer

Challenge 2

Complete the Git command to read tree data into the index.

bash Your answer
git 

Press Ctrl⌘Enter to check your answer

Challenge 3

Complete the Git command to read tree data into the index.

bash Your answer
git  <tree>

Press Ctrl⌘Enter to check your answer

Challenge 4

Complete the Git command to read tree data into the index.

bash Your answer
git  --empty

Press Ctrl⌘Enter to check your answer