Skip to content
Back to skills

Git Worktrees

ASecurity

Run parallel agents and experiments safely with git worktrees: setup, isolation, comparing and cleaning up

  • 5 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 30, 2026
developmentgonodegitdatabase

Security analysis

A100/100

Scanned November 30, 2026

npx -y skills add AdityaaaTiwari/ANVIL --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/adityaaatiwari-git-worktrees-anvil/badge)](https://www.skillsdirectory.com/skills/adityaaatiwari-git-worktrees-anvil)

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: "Run parallel agents and experiments safely with git worktrees: setup, isolation, comparing and cleaning up"
---

<!-- Generated by `anvil plugin build` from catalog/. Edit the catalog, not this file. -->

# Git worktrees for parallel work

Use when running several agents or experiments at once, or when you need a second checkout without stashing.

## Basics
- `git worktree add ../app-feature -b feature/x` creates a separate working directory on its own branch, sharing the same repository.
- `git worktree add --detach <path> HEAD` gives a throwaway checkout of the current commit.
- `git worktree list` and `git worktree remove <path>` (then `git worktree prune`) keep things tidy.

## Isolation
- Each worktree needs its own dependencies and build outputs. Install, or symlink a gitignored `node_modules` when it is safe.
- Give each one distinct ports, databases or containers when agents run servers or tests at the same time.
- A branch can be checked out in only one worktree at a time.

## Comparing agents
`anvil race --goal "..." --check "npm test" --agents claude,codex` does this for you. Each agent gets a detached worktree from the same commit, runs ANVIL's verified loop, and gets ranked by ANVIL's own checks and the integrity gate. `anvil race pick` applies the winner with a 3-way merge.

## Clean up
Remove worktrees when done (`anvil race clean` for races). Stale worktrees keep branches locked and use disk space.

## Verify
`git worktree list` shows only what you expect, and the main working tree contains only the changes you picked.

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.

View all in development →

Comments

Loading comments…

Newsletter

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