switch-worktree

Switch the current session to a specified Git worktree.

5.7k|578|Updated Jan 26, 2022
One-click install
npx skills add https://github.com/dlt-hub/dlt --skill switch-worktree-dlt-hub
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: switch-worktree
Source: https://github.com/dlt-hub/dlt/tree/main/.claude/skills/switch-worktree
Command: npx skills add https://github.com/dlt-hub/dlt --skill switch-worktree-dlt-hub

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Switch the current session to a specified git worktree to streamline multi-worktree development workflows.

Core Features & Use Cases

  • Switches the current working context to the selected worktree path.
  • Validates the worktree exists via git worktree list and reports the active worktree and branch.
  • Supports switching between multiple worktrees in a single repository to isolate tasks.

Quick Start

Provide the worktree name to switch to, and the tool will locate and switch to the corresponding worktree directory.

Frequently Asked Questions about switch-worktree

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I switch to an existing git worktree in my current session?

To switch to a git worktree, provide the worktree name. The tool locates the corresponding worktree directory, validates it exists via git worktree list, switches the cwd to that path, and reports the active worktree and branch.

What is a git worktree and when do I need to switch between them?

A git worktree is an isolated working directory linked to a single repository. You need to switch worktrees to perform tasks in isolated contexts, allowing you to manage multiple branches or tasks simultaneously without stashing changes.

Does switching git worktrees validate if the worktree exists first?

Yes, switching git worktrees validates the target exists. The tool reads the repository's worktree configuration and verifies the specified worktree path is active by checking the output of git worktree list before changing the cwd.

Can I automate switching between multiple worktrees in the same repository?

Yes, you can automate switching between multiple worktrees in a single repository. By providing the worktree name, the tool automatically locates the directory and switches your active session context to streamline multi-worktree development workflows.

What happens to my current working directory when I switch git worktrees?

When you switch git worktrees, your current working directory (cwd) changes to the specified worktree path. The tool updates the session context and reports the active worktree and branch to confirm the switch was successful.

Why does my git worktree switch fail when the worktree name is incorrect?

A git worktree switch fails when the target does not exist. The tool verifies the worktree path against git worktree list, so if the provided name is misspelled or the worktree was removed, the validation prevents changing the cwd.