Skip to content
Foxipa
Code Completion 4 Challenges

Complete the Git commands: Git mktree: Build Tree Objects from ls-tree Data

In a disposable repository, create at least two files and commit them. Obtain the commit's tree with `git rev-parse HEAD^{tree}`. Pipe its non-recursive `git ls-tree` output into `git mktree` and prove that the resulting object ID matches the original tree. Repeat with `-z`, then create a tree input that references a deliberately missing object and demonstrate the difference between default behavior and `--missing`. Finally, build two trees with one `--batch` invocation.

Advanced ~6 min read

Challenge 1

Complete the Git command to construct a tree object.

bash Your answer
git 

Press Ctrl⌘Enter to check your answer

Challenge 2

Complete the Git command to construct a tree object.

bash Your answer
git  [-z] [--missing] [--batch]

Press Ctrl⌘Enter to check your answer

Challenge 3

Complete the Git command to construct a tree object.

bash Your answer
git  < tree.txt

Press Ctrl⌘Enter to check your answer

Challenge 4

Complete the Git command to construct a tree object.

bash Your answer
git  --missing < tree-with-missing-object.txt

Press Ctrl⌘Enter to check your answer