Recall & Review
beginner
What is a Git worktree?
A Git worktree is an additional working directory linked to the same Git repository, allowing you to work on multiple branches simultaneously without switching branches in one directory.
Click to reveal answer
beginner
How do you list all existing Git worktrees?
Use the command
git worktree list to see all worktrees connected to your repository.Click to reveal answer
beginner
What is the command to remove a Git worktree safely?
Use
git worktree remove <path> to safely remove a worktree at the specified path. This deletes the worktree directory and unregisters it from Git.Click to reveal answer
intermediate
What happens if you manually delete a Git worktree directory without using Git commands?
Manually deleting the directory leaves Git unaware of the removal, causing
git worktree list to still show it. This can cause confusion or errors later.Click to reveal answer
intermediate
Why should you use
git worktree remove instead of just deleting the folder?Because
git worktree remove cleans up Git's internal records and safely deletes the worktree folder, preventing stale references and potential repository issues.Click to reveal answer
Which command lists all Git worktrees?
✗ Incorrect
The correct command to list all worktrees is
git worktree list.What does
git worktree remove <path> do?✗ Incorrect
This command safely removes the worktree folder and updates Git to forget about it.
What risk comes from deleting a worktree folder manually?
✗ Incorrect
Manual deletion leaves Git unaware, so it still lists the worktree, which can cause confusion.
Can you remove the main worktree with
git worktree remove?✗ Incorrect
The main worktree is the main repository folder and cannot be removed with this command.
What is the first step before removing a worktree?
✗ Incorrect
You should ensure no programs or terminals are using the worktree folder before removal.
Explain how to safely remove a Git worktree and why it is important.
Think about what happens inside Git when you remove a worktree.
You got /4 concepts.
Describe what a Git worktree is and how it helps in working with branches.
Imagine having multiple folders for different tasks in the same project.
You got /4 concepts.