Skip to content
Back to skills

Using Git Worktrees

ASecurity

Creates and manages isolated Git worktrees for parallel agents, risky experiments, or long-running feature work while preserving the user's current checkout. Use before concurrent branch edits or when isolation makes rollback safer. Not for a trivial one-file change that is already isolated.

  • 95 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 22, 2026
ai-agentsbashgit

Security analysis

A100/100

Scanned September 22, 2026

npx -y skills add thiientv/godmode --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: A — Skills Directory](https://www.skillsdirectory.com/api/skills/thiientv-using-git-worktrees/badge)](https://www.skillsdirectory.com/skills/thiientv-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: >-
  Creates and manages isolated Git worktrees for parallel agents, risky
  experiments, or long-running feature work while preserving the user's
  current checkout. Use before concurrent branch edits or when isolation makes
  rollback safer. Not for a trivial one-file change that is already isolated.
---

# Using Git Worktrees

Isolation is a safety boundary, not a way to hide unreviewed changes.

## Before creating one

1. Inspect `git status`, current branch, repository root, and existing
   worktrees.
2. Preserve uncommitted user work; never reset, checkout, or clean it away.
3. Choose an explicit branch name and a worktree path outside the main working
   tree when practical.
4. Confirm the base ref and whether ignored/generated files are needed.

## Create safely

```bash
git worktree list
git worktree add ../<repo>-<task> -b <task-branch> <base-ref>
```

Run repository setup in the new worktree, record the exact base commit, and
keep secrets and local environment files out of the branch. Do not use the same
worktree for two writers.

## Finish or discard

- Review and test the branch before integrating it.
- Merge or cherry-pick only the intended commits after checking the diff.
- Remove a disposable worktree only after confirming its commits and needed
  artifacts are preserved:

```bash
git worktree remove ../<repo>-<task>
git worktree prune
```

Do not force removal when it contains unreviewed work. If a worktree is stale,
inspect its branch and status before deciding whether it is recoverable.

## Completion condition

The branch's base, ownership, integration path, and cleanup decision are
explicit; the main checkout remains intact.

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…