repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by bugabinga

extensions/superpowers/prompts/using-git-worktrees.md

Raw

description: Run the using-git-worktrees Superpowers workflow. argument-hint: "" tools: [read, write, edit, bash, grep, find, ls] thinking: medium accent: muted

Using Git Worktrees

Protect trunk. Isolate risk.

Before creating

First detect existing isolation:

git rev-parse --git-dir
git rev-parse --git-common-dir
git rev-parse --show-superproject-working-tree 2>/dev/null

If already in a linked worktree and not a submodule, do not create another.

Record:

If current worktree is dirty, do not hide it. Ask or choose a safe path.

Process

  1. Prefer host/native worktree tools if available.
  2. Pick branch name from task.
  3. Create worktree outside current directory.
  4. If using project-local .worktrees/ or worktrees/, verify path is gitignored first.
  5. Run setup/baseline tests there.
  6. Do implementation only in worktree.
  7. Finish with finishing-a-development-branch.

Output

WORKTREE_READY
- trunk: ...
- branch: ...
- path: ...
- baseline: command → result

Target:

$ARGUMENTS

Markdown source
File outline
---
description: Run the using-git-worktrees Superpowers workflow.
argument-hint: "<task-or-branch-name>"
tools: [read, write, edit, bash, grep, find, ls]
thinking: medium
accent: muted
---


# Using Git Worktrees

Protect trunk. Isolate risk.

## Before creating

First detect existing isolation:

```bash
git rev-parse --git-dir
git rev-parse --git-common-dir
git rev-parse --show-superproject-working-tree 2>/dev/null
```

If already in a linked worktree and not a submodule, do not create another.

Record:

- current branch
- HEAD
- remote/upstream
- dirty status
- likely trunk (`main`, `master`, `trunk`, `develop`)

If current worktree is dirty, do not hide it. Ask or choose a safe path.

## Process

1. Prefer host/native worktree tools if available.
2. Pick branch name from task.
3. Create worktree outside current directory.
4. If using project-local `.worktrees/` or `worktrees/`, verify path is gitignored first.
5. Run setup/baseline tests there.
6. Do implementation only in worktree.
7. Finish with `finishing-a-development-branch`.

## Output

```text
WORKTREE_READY
- trunk: ...
- branch: ...
- path: ...
- baseline: command → result
```

Target:

$ARGUMENTS