git-worktrees

Manages parallel branch development using Git worktrees for isolated agent workflows.

111|73|Updated Mar 20, 2026
One-click install
npx skills add https://github.com/autopus-ai/autopus-adk --skill git-worktrees-autopus-ai
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: git-worktrees
Source: https://github.com/autopus-ai/autopus-adk/tree/main/.omp/skills/git-worktrees
Command: npx skills add https://github.com/autopus-ai/autopus-adk --skill git-worktrees-autopus-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Working on multiple branches simultaneously normally requires constant stashing and switching, and parallel coding agents editing the same checkout cause file conflicts. This Skill provides Git worktree commands and patterns so multiple branches can be checked out in separate directories at once. ## Core Features & Use Cases - Parallel Branch Checkouts: Create, list, and remove worktrees with git worktree add, list, remove, and prune. - Agent Isolation Pattern: Spawn per-agent worktrees under /tmp so backend, frontend, and tester agents edit files independently without conflicts. - Concurrent Hotfix and Review Workflows: Handle a security hotfix or check out a PR branch for review while feature development continues in the main checkout. - Cleanup Script: A shell snippet that finds and removes stale agent worktrees, then prunes metadata. - Use Case: While building a feature, a critical security patch arrives. Create a worktree for the hotfix branch, commit and push the fix there, then return to your feature work without stashing anything. ## Quick Start Ask the agent to create a Git worktree for a hotfix branch so you can patch it without interrupting your current feature work.

Frequently Asked Questions about git-worktrees

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I work on two Git branches at the same time?▼

Use git worktree add to check out a second branch into a separate directory, for example git worktree add ../project-hotfix hotfix/critical-fix. Each directory has its own working files while sharing the same repository history.

How to isolate parallel coding agents with Git worktrees?▼

Create one worktree per agent with unique branch names, such as git worktree add /tmp/agent-backend-work agent/backend-$(date +%s). Each agent edits files independently, and results are merged back into the main branch after completion.

Can two worktrees use the same branch?▼

No, Git does not allow the same branch to be checked out in two worktrees simultaneously. Create a separate branch for each worktree, which is why the agent pattern generates timestamped branch names.

How do I remove old Git worktrees?▼

Run git worktree remove <path> for each worktree, then git worktree prune to clean stale metadata. The included cleanup script lists worktrees under /tmp/agent- and removes them automatically.

Do Git worktrees share the .git directory?▼

Yes, all worktrees share the same repository data including commits and refs, but each has independent working files and staging areas. Avoid spaces in worktree paths to prevent tooling issues.