# Using Git Worktrees

> Use when starting feature work that needs isolation or before executing implementation plans. Creates isolated git worktrees with safety verification.

- **Type:** Skill
- **Install:** `agentstack add skill-himmelreich-it-agent-skill-converter-using-git-worktrees`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [himmelreich-it](https://agentstack.voostack.com/s/himmelreich-it)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** Apache-2.0
- **Upstream author:** [himmelreich-it](https://github.com/himmelreich-it)
- **Source:** https://github.com/himmelreich-it/agent-skill-converter/tree/main/out/junie/skills/superpowers/skills/using-git-worktrees

## Install

```sh
agentstack add skill-himmelreich-it-agent-skill-converter-using-git-worktrees
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Using Git Worktrees

Git worktrees create isolated workspaces sharing the same repository, allowing work on multiple branches simultaneously without switching.

**Core principle:** Systematic directory selection + safety verification = reliable isolation.

**Announce at start:** "I'm using the `using-git-worktrees` skill to set up an isolated workspace."

## Directory Selection Process

Follow this priority order:

### 1. Check Existing Directories
Check for `.worktrees` (preferred) or `worktrees` in the project root. If found, use that directory.

### 2. Check Guidelines
Check `CLAUDE.md` or other project guidelines for worktree preferences. If specified, use it.

### 3. Ask User
If no directory is found and no preference is specified, ask the user:
"No worktree directory found. Where should I create worktrees?
1. `.worktrees/` (project-local, hidden)
2. `~/.config/junie/worktrees//` (global location)
Which would you prefer?"

## Safety Verification

### For Project-Local Directories
**MUST verify directory is ignored before creating worktree:**
`git check-ignore -q .worktrees`

**If NOT ignored:**
1. Add the directory to `.gitignore`.
2. Commit the change with the Junie co-authored trailer.
3. Proceed with worktree creation.

**Why critical:** Prevents accidentally committing worktree contents to the repository.

## Creation Steps

### 1. Create Worktree
1. Determine the branch name.
2. Create the worktree: `git worktree add  -b `
3. Change directory to the new worktree: `cd `

### 2. Run Project Setup
Auto-detect and run appropriate setup (e.g., `npm install`, `pip install -e .`, `uv sync`).

## Key Benefits
- **Isolation** - No accidental changes to your current branch.
- **Speed** - No need to stash/unstash when switching tasks.
- **Parallelism** - Work on multiple tasks at once in different worktrees.

## Remember
- Always check `.gitignore` first.
- Follow project setup conventions in the new worktree.
- Inform the user of the new worktree path.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [himmelreich-it](https://github.com/himmelreich-it)
- **Source:** [himmelreich-it/agent-skill-converter](https://github.com/himmelreich-it/agent-skill-converter)
- **License:** Apache-2.0

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-himmelreich-it-agent-skill-converter-using-git-worktrees
- Seller: https://agentstack.voostack.com/s/himmelreich-it
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
