Skip to content
Foxipa
Code Completion 4 Challenges

Complete the Git commands: Git Worktree Lifecycle: Lock, Move, Repair, Prune, and Remove

In a disposable repository, create one linked worktree for a branch and prove it appears in `git worktree list`. Lock it with a reason, inspect the locked annotation, and demonstrate that normal removal is refused. Unlock it, move it with `git worktree move`, and verify the new path. Create a second linked worktree, move that directory manually, observe the stale administrative state, repair it with `git worktree repair`, and then remove it cleanly. Finally create a detached worktree, delete its directory manually, run `git worktree prune -n -v` to preview cleanup, then run `git worktree prune -v` and verify the stale entry is gone. Separately, create an unclean disposable worktree and demonstrate that normal removal refuses it before using `--force` only to discard that disposable worktree.

Advanced ~6 min read

Challenge 1

Complete the Git command to manage linked worktrees.

bash Your answer
git  list

Press Ctrl⌘Enter to check your answer

Challenge 2

Complete the Git command to manage linked worktrees.

bash Your answer
git  move

Press Ctrl⌘Enter to check your answer

Challenge 3

Complete the Git command to manage linked worktrees.

bash Your answer
git  repair

Press Ctrl⌘Enter to check your answer

Challenge 4

Complete the Git command to manage linked worktrees.

bash Your answer
git  prune -n -v

Press Ctrl⌘Enter to check your answer