Back to lessons

Working with Worktrees

Check out multiple branches simultaneously using Git worktrees.

Step 1 of 520%

Git worktrees let you check out multiple branches at the same time in different directories. Perfect for reviewing PRs, working on features while fixing bugs, or comparing branches side by side.

Worktrees are one of Git's lesser-known but most powerful features. Normally, you can only have one branch checked out at a time per repository clone. Worktrees remove this limitation by linking an additional working directory to the same repository. Each worktree has its own working directory and staging area, but they share the same object database and refs — so disk usage is minimal.
1 / 5