0
0
Gitdevops~5 mins

Listing worktrees in Git - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a Git worktree?
A Git worktree is an additional working directory linked to the same Git repository. It lets you work on multiple branches at the same time without switching branches in one folder.
Click to reveal answer
beginner
Which command lists all Git worktrees?
The command git worktree list shows all the worktrees connected to the repository, including their paths and the branches checked out.
Click to reveal answer
intermediate
What information does git worktree list display?
It shows the path of each worktree, the branch or commit checked out there, and if the worktree is locked or not.
Click to reveal answer
intermediate
How can you identify the main worktree in the list?
The main worktree is usually the one with the repository root path and no special lock status. It is the original working directory of the repo.
Click to reveal answer
beginner
Why use multiple worktrees instead of branches in one folder?
Multiple worktrees let you work on different branches at the same time without switching or losing changes. It’s like having multiple copies of your project linked to the same history.
Click to reveal answer
Which command shows all Git worktrees?
Agit status
Bgit branch -a
Cgit checkout
Dgit worktree list
What does a Git worktree allow you to do?
AWork on multiple branches at the same time
BDelete branches permanently
CMerge branches automatically
DClone a repository
In the output of git worktree list, what does the path represent?
AThe commit hash
BThe remote repository URL
CThe location of the worktree directory
DThe branch name only
How do you know which worktree is the main one?
AIt is always named 'main'
BIt has the root repository path and no lock status
CIt is the newest worktree
DIt is locked
What happens if you delete a worktree folder without removing it from Git?
AGit still thinks the worktree exists and may cause errors
BGit automatically removes it
CNothing, it is safe
DThe branch is deleted
Explain what a Git worktree is and why you might use multiple worktrees.
Think about having multiple project folders linked to the same Git history.
You got /3 concepts.
    Describe how to list all worktrees in a Git repository and what information you get from the list.
    Focus on the command and the details it shows.
    You got /4 concepts.