Skip to content
Back to skills

Git Worktrees

ASecurity

Work on multiple branches in parallel using git worktrees via the git-wt helper to avoid context switching or merge noise.

  • 666 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added February 8, 2026
toolsshellexpressgitdatabase

Security analysis

A100/100

Scanned February 12, 2026

npx -y skills add majiayu000/claude-skill-registry --skill git-worktrees --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Git Worktrees?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Git Worktrees
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/majiayu000-git-worktrees/badge)](https://www.skillsdirectory.com/skills/majiayu000-git-worktrees)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: git-worktrees
description: Work on multiple branches in parallel using git worktrees via the git-wt helper to avoid context switching or merge noise.
trigger: always_on
---
This skill follows `engineering-doctrine`.

## Core Model

- One branch == one directory == one line of work
- All worktrees share a single `.git` database
- Each worktree is bound to its branch while it exists

## Preferred Tooling

Use `git wt` (https://github.com/k1LoW/git-wt) as the default interface. It wraps `git worktree` with safer defaults and faster workflows.

## Standard Setup

Optional, if you want worktrees stored in `.worktrees`:

```sh
mkdir -p .worktrees
git config wt.basedir .worktrees
```

## Quick Start

```sh
git wt                       # list worktrees
git wt <branch|worktree>     # switch/create (creates branch and worktree if needed)
git wt --nocd <branch|worktree>
git wt -d <branch|worktree>  # safe delete (worktree + branch)
git wt -D <branch|worktree>  # force delete
```

## Configuration

Use `git config` for defaults; override with flags when needed.

- `wt.basedir` / `--basedir`: base directory for worktrees (default `../{gitroot}-wt`)
- `wt.copyignored` / `--copyignored`: copy gitignored files on create
- `wt.copyuntracked` / `--copyuntracked`: copy untracked files on create
- `wt.copymodified` / `--copymodified`: copy modified tracked files on create
- `wt.nocopy` / `--nocopy`: exclude files from copying (gitignore syntax)
- `wt.copy` / `--copy`: always copy specific patterns even if ignored
- `wt.hook` / `--hook`: run commands after creating a new worktree
- `wt.nocd` / `--nocd`: prevent automatic directory switching

## Shell Integration (PowerShell)

```powershell
Invoke-Expression (git wt --init powershell | Out-String)
```

## Cleanup
always check if there are uncommitted changes in a worktree before
- removing its branch
- deleting the local worktree folder

Use `git wt -d <branch|worktree>` for clean removals.
If a worktree folder was deleted manually, run `git worktree prune`.
Ask user what to do with those uncommitted changes.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.