Worktree Ops
Quick start
- Create worktree (required when skill used):
git worktree add <path> <branch>(or-b <branch> <start-point>) - Sync local-only files: copy
scripts/worktree-include.shfrom this skill into repo, then run./scripts/worktree-include.sh - Optional wrapper: copy
scripts/worktree-add.shfrom this skill into repo - Optional hook: copy
scripts/husky-post-checkout.shto.husky/post-checkout - Add local-only files to
.worktreeinclude(format below)
Requirements
- Git installed
bashavailable (forworktree-include.shandworktree-add.sh)- Husky optional (the hook only runs if Husky is installed/enabled)
Conventions
- When this skill is invoked, create a new worktree by default. If path/branch not specified, ask for them.
- Keep local-only secrets/configs out of git; list in
.worktreeinclude - Prefer
copyfor env/profiles/keys; usesymlinkonly when safe - Use hook behavior:
.husky/post-checkoutruns include once on fresh worktree (hook file stored in this skill)
Details
.worktreeincludeformat:<mode> <source> [dest], mode =copy|symlink, paths relative to main worktree root- Paths cannot contain spaces (simple parser)
- Example
.worktreeinclude:copy .env.localsymlink .vscode/settings.json .vscode/settings.json
scripts/worktree-include.sh:- resolve main root via
git rev-parse --git-common-dir - copy/symlink from main to current worktree
- skip if src missing or dest exists
- resolve main root via
scripts/worktree-add.sh:git worktree add -bif start-point provided- run include script in new worktree
