Skip to content
Skills Library
Programming · Automation

create-git-worktree

/create-git-worktree

Manual invocation only; use only when the user explicitly requests `create-git-worktree` by exact name. Create a clean git worktree for the current repository and symlink reusable local tool-state directories into it.

Licence
MIT
Last repository change
11.05.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
3
Scripts
1
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 11.05.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What to check before installing
  • 1 scripts in this package. Review them before installing, as Claude may execute them.

Scripts: scripts/create_worktree.sh

What it does and when to use it

Manual invocation only; use only when the user explicitly requests `create-git-worktree` by exact name. Create a clean git worktree for the current repository and symlink reusable local tool-state directories into it.

Original author description

Manual invocation only; use only when the user explicitly requests `create-git-worktree` by exact name. Create a clean git worktree for the current repository and symlink reusable local tool-state directories into it.

How it works

  1. Quick Start
  2. Workflow
  3. Resources
  4. Example Prompts
Original SKILL.md headings · 86 lines, 474 words
SKILL.md preview
---
name: create-git-worktree
description: Manual invocation only; use only when the user explicitly requests `create-git-worktree` by exact name. Create a clean git worktree for the current repository and symlink reusable local tool-state directories into it.
---

# Create Git Worktree

Manual invocation only: use this skill only when the user explicitly requests `create-git-worktree` by exact name.

Create a fresh worktree from the current repository while leaving the active checkout untouched. Prefer the bundled script so branch handling, default paths, and safe symlink rules stay consistent.

## Quick Start

Run:

```bash
bash scripts/create_worktree.sh [--branch BRANCH] [--path TARGET_PATH] [--link-dir NAME]
```

Use these defaults unless the user says otherwise:

- Source ref: current branch from `git branch --show-current`
- Target path: `<repo-root>/.shadow-repo/worktree-<ts>`
- Timestamp format: `YYYYMMDD-HHMMSS` in UTC
- Extra symlink dirs: none

If the user specifies a path, use it instead of the default. If the user specifies extra directories to reuse, pass them with repeated `--link-dir` flags.

## Workflow

### 1. Resolve the source ref

- Use the user-selected branch or ref if provided.
- Otherwise use the current branch.
- If the current checkout is detached and the user did not provide a branch or ref, pause and ask for one.

### 2. Create the worktree with Git

- Use `git worktree add`; do not copy the repository manually.
- If the source ref is a local branch that is not checked out in another worktree, create a normal branch worktree.
- If that branch is already checked out elsewhere, create a detached worktree at the branch tip instead. This preserves the requested clean snapshot while avoiding Git's branch checkout conflict.

### 3. Symlink reusable local-state directories

Consider these default candidates:

- `.claude`
- `.codex`
- `.gemini`
- `.github`
- `.aider`
- `.cursor`
- `.continue`
- `.windsurf`
- `.kiro`

Apply these rules for each candidate and for any user-requested extra directory:

- Symlink only when the source path already exists in the repo root.
- Skip the path if Git tracks any files under it.
- Do not replace tracked content in the new worktree with a symlink.

### 4. Handle Pixi projects

- Detect Pixi via `pixi.toml`, `pixi.lock`, or a `[tool.pixi]` section in `pyproject.toml`.
- If the repo is Pixi-managed and `.pixi/` exists as an untracked directory, symlink it into the new worktree.

### 5. Verify and report

Report:

- The created worktree path
- The source ref used
- The resulting commit
- Whether the worktree is attached to a branch or detached
- Which directories were linked
- Which directories were skipped because they were tracked

Note that `git status` in the new worktree may show the linked local-state directories as untracked. That is expected.

## Resources

- `scripts/create_worktree.sh`: Create the worktree and add the safe symlinks.

## Example Prompts

- `Create a shadow worktree for this repo under .shadow-repo and link the agent home directories.`
- `Make a clean worktree of branch release/1.4 at tmp/release-wt and reuse .claude and .pixi.`
- `Create a worktree for this repo at /tmp/gig-agents-clean; keep my current uncommitted changes untouched.`
Files in this package (3)
  • SKILL.md 3 KB
  • agents/openai.yaml 1 KB
  • scripts/create_worktree.sh 6 KB

Versions

The database has no other skills named create-git-worktree.

Database snapshot: 13.11.2026 · package version 20b1cad068f0 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100impl-via-git-worktree
    Manual invocation only; use only when the developer explicitly requests `impl-via-git-worktree` or asks for implementation in a fresh local branch/worktree. Snapshot the current repository state into a new local `feature/topic-slug` or `fix/topic-slug` branch, create a separate…
  • 100create-worktree
    Create a ClickHouse git worktree with submodules hardlinked from the main repo. Use when the user wants to create a new worktree for ClickHouse development.
  • 95worktree
    Git worktree automation for isolated feature development. Triggers on: '/worktree create', '/worktree list', '/worktree remove'. Creates isolated working directories with automatic setup.
  • 100worktree
    Creates new git worktree with symlinked/copied assets and independent environment setup. Triggers on keywords: worktree, create worktree, new worktree, git worktree
  • 100git-wtpr
    Opens or deletes a git-wt worktree for a GitHub pull request. Use when creating, switching to, or removing a PR worktree.
  • 100worktree
    Manages git worktrees with git-wt, including PR checkouts. Use when the user asks to create, switch, or delete a worktree, or check out a PR.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.