git-worktree
Create, inspect, and clean up Git worktrees for parallel TermLink branch development. Use when starting isolated feature or bugfix work in a separate directory, checking which branches already have at
SKILL.mdskills/git-worktree/SKILL.md
GitHubGit Worktree
Overview
Use this skill to run multiple TermLink tasks in parallel without stashing or mixing local changes in one checkout.
Run commands from repository root:
E:\coding\TermLink
Quick Checks
- List active worktrees before creating or removing anything:
git worktree list
- Confirm whether a branch already exists:
git branch --list feat/my-topic
Create A Worktree
Preferred helper for a new branch worktree:
powershell -ExecutionPolicy Bypass -File .\skills\git-worktree\scripts\new-worktree.ps1 -Branch feat/my-topic -Base main
Behavior:
- Resolve the current repository root.
- Create a sibling directory such as
E:\coding\TermLink-feat-my-topic. - Run
git worktree add -b <branch> <path> <base>. - Copy repository-local assistant config directories
.codexand.claudeinto the new worktree when they exist. - Print the created path for follow-up work.
Optional variants:
# Reuse an existing branch instead of creating a new one
powershell -ExecutionPolicy Bypass -File .\skills\git-worktree\scripts\new-worktree.ps1 -Branch feat/my-topic -CheckoutExisting
# Override the default path
powershell -ExecutionPolicy Bypass -File .\skills\git-worktree\scripts\new-worktree.ps1 -Branch feat/my-topic -Base main -Path E:\coding\TermLink-wt\feat-my-topic
Remove And Prune
Remove a worktree after merge or abandonment:
git worktree remove E:\coding\TermLink-feat-my-topic
git worktree prune
Use force only when the user explicitly wants to discard uncommitted changes:
git worktree remove --force E:\coding\TermLink-feat-my-topic
git worktree prune
Rules
- Check
git worktree listbefore creating a new worktree to avoid path or branch collisions. - Prefer an explicit base branch such as
mainfor new feature worktrees. - Keep worktrees outside the repository root as sibling directories; do not create nested worktrees inside tracked folders.
- Do not remove a worktree with uncommitted changes unless the user explicitly asks to discard them.
- Run
git worktree pruneafter removal so stale metadata does not block later reuse. - When creating a worktree, keep
.codexand.claudesynced into the new directory so local agent workflows continue to work there.