create-worktree

Creates or reuses Git linked worktrees with carried-over uncommitted changes and environment setup.

Updated May 19, 2026
One-click install
npx skills add https://github.com/wenyue/SmartKit --skill create-worktree-wenyue
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: create-worktree
Source: https://github.com/wenyue/SmartKit/tree/main/docs/zh-CN/skills/create-worktree
Command: npx skills add https://github.com/wenyue/SmartKit --skill create-worktree-wenyue

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Parallel tasks, isolated workflows, or protecting the current checkout often require a separate Git working tree, and manually creating one while preserving uncommitted work is error-prone. This Skill selects or creates a linked worktree, carries over the source workspace's staged, unstaged, and untracked changes by default, prepares its environment, and returns a clear ready or non-ready verdict. ## Core Features & Use Cases - Worktree selection and creation: Reuses an attributable existing worktree or creates a new one at a safe, conflict-free path with a named branch from a frozen immutable base. - Carry-over with confirmation: Snapshots staged, unstaged, and untracked changes, counts lines and paths, and asks for explicit user confirmation when thresholds (300 lines or 10 paths) are exceeded; clean mode creates from the base without source changes. - Verification and environment setup: Validates registration, branch, HEAD, index, and worktree state against expectations, delegates environment preparation to a worktree-environment-setup Skill when present, and never mutates the source workspace. - Use Case: You are mid-feature with uncommitted changes and need to review a colleague's branch in isolation. The Skill creates a new worktree carrying your current state, sets up dependencies, and hands back a ready workspace without touching your original checkout. ## Quick Start Create a new Git worktree for my current task that carries over my uncommitted changes and prepares its environment.

Frequently Asked Questions about create-worktree

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

FAQPage Schema
How do I create a Git worktree that keeps my uncommitted changes?▼

Use carry mode, which snapshots the source workspace's HEAD, staged, unstaged, and untracked state and reproduces it in the new worktree. The source files, index, and HEAD are never modified during the transfer.

What is the difference between git worktree and git clone?▼

A linked worktree shares the repository's Git common directory and object store, avoiding a full duplicate clone. This Skill creates worktrees registered under the same repository, with a named branch from a frozen base commit.

When does the Skill ask for confirmation before carrying changes?▼

Confirmation is required when the carried diff reaches 300 or more changed lines or 10 or more changed paths, counting staged, unstaged, and untracked changes. Below both thresholds, changes are carried by default and the counts are reported.

Can I create a clean worktree without my current changes?▼

Yes, clean mode creates the worktree from the selected immutable base with a clean index and worktree, skipping carry-over capture and confirmation. Specifying a different base requires explicitly choosing clean creation or agreed carry semantics.

What happens if worktree creation fails or is interrupted?▼

Partial paths, refs, registrations, and copied state are preserved for their recovery owner, and removal only occurs when artifacts are proven to come solely from the failed attempt. The Skill returns non-ready with blockers and next steps.

Does the worktree setup run project builds or tests?▼

No, environment preparation is delegated to a worktree-environment-setup Skill when one exists for the target. This Skill does not run project baselines, builds, or tests; repository verification remains the responsibility of implementation and finishing workflows.