# Git Worktree Manager

> Manage git worktrees for efficient multi-branch development. Use when creating worktrees for feature branches, organizing worktree directories, cleaning up unused worktrees, or implementing worktree-based workflows.

- **Type:** Skill
- **Install:** `agentstack add skill-d-o-hub-rust-self-learning-memory-git-worktree-manager`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [d-o-hub](https://agentstack.voostack.com/s/d-o-hub)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [d-o-hub](https://github.com/d-o-hub)
- **Source:** https://github.com/d-o-hub/rust-self-learning-memory/tree/main/.agents/skills/git-worktree-manager
- **Website:** https://d-o-hub.github.io/rust-self-learning-memory/

## Install

```sh
agentstack add skill-d-o-hub-rust-self-learning-memory-git-worktree-manager
```

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

## About

# Git Worktree Manager

Manage git worktrees to enable parallel multi-branch development while keeping the main working directory clean.

## Recommended Directory Structure

```
project/
├── main-repo/          # Main working directory
└── worktrees/          # All worktrees here
    ├── feature/name/
    ├── bugfix/name/
    └── experiment/name/
```

## Core Commands

### Create Worktree
```bash
# From existing branch
git worktree add ../worktrees/feature-name feature-branch

# Create new branch
git worktree add -b feature/new ../worktrees/new-feature

# Detached HEAD (specific commit)
git worktree add ../worktrees/temp HEAD~5
```

### List Worktrees
```bash
git worktree list
git worktree list --porcelain  # Machine-readable
```

### Remove Worktree
```bash
git worktree remove ../worktrees/name        # Safe (clean only)
git worktree remove --force ../worktrees/name  # Force removal
git worktree prune                           # Clean administrative data
```

### Lock/Unlock
```bash
git worktree lock ../worktrees/name    # Prevent operations
git worktree unlock ../worktrees/name
```

## Workflow Patterns

### Feature Development
```bash
git worktree add -b feature/new ../worktrees/feature/new
cd ../worktrees/feature/new
# ... develop ...
cargo test  # Test in isolation
git push
cd /path/to/main && git merge feature/new
git worktree remove ../worktrees/feature/new
```

### Parallel Testing
```bash
for branch in feature/a feature/b; do
  git worktree add ../worktrees/$branch $branch
  cd ../worktrees/$branch && cargo test &
done
wait
```

### Code Review
```bash
git worktree add ../worktrees/review/pr-123 origin/pr-123
cd ../worktrees/review/pr-123
cargo test
git worktree remove ../worktrees/review/pr-123
```

## Find Orphaned Worktrees
```bash
git worktree list | while read path commit branch; do
  if ! git show-ref --verify --quiet "refs/heads/${branch#*/}"; then
    echo "Orphaned: $path"
  fi
done
```

## Best Practices

### DO
- Organize in `../worktrees/` directory
- Use descriptive branch-based names
- Clean up after merging
- Test before merging to main
- Prune regularly to remove orphaned data

### DON'T
- Create in random locations
- Leave with uncommitted changes
- Forget to prune administrative data
- Create conflicting branches
- Mix worktree/non-worktree workflows

## Source & license

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

- **Author:** [d-o-hub](https://github.com/d-o-hub)
- **Source:** [d-o-hub/rust-self-learning-memory](https://github.com/d-o-hub/rust-self-learning-memory)
- **License:** MIT
- **Homepage:** https://d-o-hub.github.io/rust-self-learning-memory/

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-d-o-hub-rust-self-learning-memory-git-worktree-manager
- Seller: https://agentstack.voostack.com/s/d-o-hub
- 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%.
