Skip to content
Foxipa
Code Completion 4 Challenges

Complete the Git commands: Git write-tree: Turn the Index into Tree Objects

Create a disposable repository containing a nested directory and at least two files. Stage the files, run `git write-tree`, and prove that the returned object is a tree. Then run `git write-tree --prefix=<your-directory>/` and inspect the resulting subtree with `git ls-tree`. Finally, create an unresolved merge in a disposable repository and demonstrate that `git write-tree` refuses the unmerged index; resolve the conflict, stage the result, and show that write-tree succeeds.

Advanced ~6 min read

Challenge 1

Complete the Git command to write the index as a tree object.

bash Your answer
git 

Press Ctrl⌘Enter to check your answer

Challenge 2

Complete the Git command to write the index as a tree object.

bash Your answer
git  --prefix=<your-directory>/

Press Ctrl⌘Enter to check your answer

Challenge 3

Complete the Git command to write the index as a tree object.

bash Your answer
git  --prefix=sub/

Press Ctrl⌘Enter to check your answer

Challenge 4

Complete the Git command to write the index as a tree object.

bash Your answer
git  --missing-ok

Press Ctrl⌘Enter to check your answer