Skip to content
Back to skills

Using Git Worktrees

BSecurity

Create isolated workspaces via git worktrees for parallel development. Safety verification ensures worktree directories are gitignored before use.

  • 7 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added May 27, 2026
developmentpythongobashnodegit

Security analysis

B84/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned May 27, 2026

npx -y skills add Vimalk0703/shipworthy --skill using-git-worktrees --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Using Git Worktrees?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Using Git Worktrees
[![Security: B — Skills Directory](https://www.skillsdirectory.com/api/skills/vimalk0703-using-git-worktrees/badge)](https://www.skillsdirectory.com/skills/vimalk0703-using-git-worktrees)

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: using-git-worktrees
description: Create isolated workspaces via git worktrees for parallel development. Safety verification ensures worktree directories are gitignored before use.
invoke_when: Use when working on a separate branch without stashing current work, doing parallel feature development, or when isolation is required for a task.
---

# Using Git Worktrees

## What Are Worktrees?

Git worktrees let you check out multiple branches simultaneously in separate directories. Each worktree has its own working directory but shares the same git history.

## When to Use

- Working on a hotfix while a feature is in progress
- Running tests on one branch while developing on another
- Isolating experimental changes from stable work

## Setup Pattern

### 1. Choose a Worktree Location
Check for project conventions:
- Look for `.worktrees/` directory
- Check CLAUDE.md or architecture.md for guidance
- Default: `.worktrees/` in project root

### 2. Safety Verification
Before creating a worktree:
- Ensure the worktree directory is in `.gitignore`
- If not, add it before proceeding

### 3. Create the Worktree
```bash
git worktree add .worktrees/feature-name -b feature/feature-name
```

### 4. Install Dependencies
Detect project type and install:
- Node.js: `cd .worktrees/feature-name && npm install`
- Python: `cd .worktrees/feature-name && pip install -r requirements.txt`
- Go: `cd .worktrees/feature-name && go mod download`

### 5. Run Baseline Tests
Before starting work, verify the worktree is healthy:
```bash
cd .worktrees/feature-name && npm test
```

## Cleanup

When done with a worktree:
```bash
git worktree remove .worktrees/feature-name
git branch -d feature/feature-name  # if merged
```

## Rules
- Never delete a worktree directory manually — use `git worktree remove`
- Don't modify the same branch from multiple worktrees
- Clean up worktrees when done to avoid confusion

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.

Comments

Loading comments…