Docs › Git
Worktrees
Choose which checkout of a repository the git view works on, and add or remove worktrees.
Where Terminal dock › Worktree
1 min read
How it works
- Open the worktrees page: the folder tile on a running terminal's dock, whose tip names the worktree, the worktree button at the head of the git view, or Git: Worktrees in the command palette.
- The workspace's own folder is listed first, as main, then every other worktree with its branch, including those loops made.
- Pick one for Switch to worktree, Open terminal here, Copy path or Remove worktree. Switching points the git view, the branches page and the Changes widget at that checkout, and the choice is kept for the workspace.
- Add worktree... asks for a folder and a branch, existing or new, and switches to the worktree once it is made.
Good to know
- Switching moves no tab: a terminal keeps running where it started. Open terminal here starts a new one in the worktree.
- Removing a worktree with uncommitted changes asks again, with Force.
- main cannot be removed. A worktree whose folder has gone is tagged missing and offers Prune.
- A worktree inside the workspace's folder may show up as untracked files in the main checkout, and the dialog warns you of it.