using-git-worktrees-d83c3a — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited using-git-worktrees-d83c3a (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
When working with multiple branches simultaneously, needing isolated working directories for parallel development, or managing worktree lifecycle operations. Worktrees allow multiple working trees attached to the same repository, sharing a single .git directory. This eliminates stashing, context-switching overhead, and the risk of uncommitted changes bleeding across tasks.
Use this skill when you need to:
.git store(git does NOT allow the same branch in two worktrees simultaneously)
.worktrees/ directory: project/ # main worktree
project/.worktrees/
feat-auth/ # linked worktree for auth feature
fix-payments/ # linked worktree for payments bug
review-pr-42/ # linked worktree for PR review[type]-[short-description] matching branch suffixCore commands:
| Operation | Command |
|---|---|
| Create from existing branch | git worktree add ../.worktrees/[name] [branch] |
| Create with new branch | git worktree add -b feat/[name] ../.worktrees/[name] |
| List all worktrees | git worktree list |
| Show worktree details | git worktree list --verbose |
| Remove a worktree | git worktree remove ../.worktrees/[name] |
| Force remove (dirty) | git worktree remove --force ../.worktrees/[name] |
| Clean stale entries | git worktree prune |
| Lock (prevent prune) | git worktree lock ../.worktrees/[name] |
| Unlock | git worktree unlock ../.worktrees/[name] |
Workflow patterns:
# Continue working on your feature
git worktree add -b feat/new-api ../.worktrees/feat-new-api
# Simultaneously review a colleague's PR
git worktree add ../.worktrees/review-pr-42 origin/feat/their-branch git worktree add ../.worktrees/test-main main
git worktree add ../.worktrees/test-release release/2.0
# Run test suites in each directory independentlyGotchas and constraints:
git submodule update --init in each new worktree if needed
.gitignore'd build artifacts are per-worktree (each has its own node_modules,build output, etc.)
.vscode/, .idea/) are per-worktree — configure each separately.git/hooks/ are shared across all worktreesgit stash is shared — stashes from one worktree are visible in all # Verify the branch is fully merged
git branch --merged main | grep [branch-name]
# Remove the worktree
git worktree remove ../.worktrees/[name]
# Delete the branch if no longer needed
git branch -d [branch-name]
# Prune any stale worktree references
git worktree prunegit worktree listgit worktree prune weekly as maintenance hygienegit worktree list to audit — if a worktree's branch no longer existson remote, it is likely stale
git worktree list shows only the main worktree (or active ones).worktrees/git branch -v shows no dangling local branches from removed worktreesBefore marking a worktree-related task done:
.worktrees/ sibling directory convention?git worktree prune to remove stale references?git worktree list shows a clean state?~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.