Skip to content
Foxipa
Code Completion 4 Challenges

Complete the Git commands: Git Multiple Worktrees

Create a repository with one initial commit. Then create (1) a linked worktree on a new branch named `feature-a`, (2) another linked worktree on a new branch named `feature-b`, and (3) a detached worktree at the initial commit. Use `git worktree list --porcelain` to verify all worktrees. Finally, make a distinct uncommitted edit in each linked worktree and confirm that each directory has its own working-tree state. Success criteria: the main worktree and all three linked worktrees appear in the listing; feature-a and feature-b are named branches; the experiment worktree is detached; and an edit made in one worktree does not silently appear as an uncommitted edit in another worktree.

Intermediate ~6 min read

Challenge 1

Complete the Git command to manage linked worktrees.

bash Your answer
git  list --porcelain

Press Ctrl⌘Enter to check your answer

Challenge 2

Complete the Git command to create the repository.

bash Your answer
git  demo

Press Ctrl⌘Enter to check your answer

Challenge 3

Complete the Git command to stage the path.

bash Your answer
git  README.md

Press Ctrl⌘Enter to check your answer

Challenge 4

Complete the Git command to create the requested commit.

bash Your answer
git  -m "Initial"

Press Ctrl⌘Enter to check your answer