Claude-skill-registry git-worktrees
Work on multiple branches in parallel using git worktrees via the git-wt helper to avoid context switching or merge noise.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/git-worktrees" ~/.claude/skills/majiayu000-claude-skill-registry-git-worktrees && rm -rf "$T"
manifest:
skills/data/git-worktrees/SKILL.mdsource content
This skill follows
engineering-doctrine.
Core Model
- One branch == one directory == one line of work
- All worktrees share a single
database.git - 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:
mkdir -p .worktrees git config wt.basedir .worktrees
Quick Start
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
: base directory for worktrees (default--basedir
)../{gitroot}-wt
/wt.copyignored
: copy gitignored files on create--copyignored
/wt.copyuntracked
: copy untracked files on create--copyuntracked
/wt.copymodified
: copy modified tracked files on create--copymodified
/wt.nocopy
: exclude files from copying (gitignore syntax)--nocopy
/wt.copy
: always copy specific patterns even if ignored--copy
/wt.hook
: run commands after creating a new worktree--hook
/wt.nocd
: prevent automatic directory switching--nocd
Shell Integration (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.