Adding Worktrees
A Worktree allows you to check out a specific branch or revision in a separate directory, enabling you to work on multiple branches simultaneously without affecting your primary working directory.
Ways to Add a Worktree
- From the Sidebar: Click the button at the bottom of the sidebar and select .
- From a Branch: Right-click a branch and select to quickly create a Worktree for that branch.
The “Add Worktree” Dialog
The dialog for adding a Worktree provides the following options:
- Revision or Branch: Choose the branch or revision to check out in the new Worktree.
- Destination Folder: Specify the location for the new Worktree.
- Detach Worktree: Enable this option to create a Worktree that is detached from any branch. A detached Worktree operates directly on the selected revision, which can be useful for testing or inspecting historical commits without affecting branch history.
Worktree Destination
When creating a new Worktree, ensure that the destination folder is outside your main repository directory. Placing a Worktree inside your main repository folder can lead to unintended conflicts or issues with Git’s .git directory structure.