Get the FREE Ultimate OpenClaw Setup Guide →

using-git-worktrees

npx machina-cli add skill a5c-ai/babysitter/using-git-worktrees --openclaw
Files (1)
SKILL.md
902 B

Using Git Worktrees

Overview

Create isolated workspaces sharing the same repository. Systematic directory selection + safety verification.

Core principle: Isolated workspace before implementation.

Process

  1. Check existing directories (.worktrees/ or worktrees/)
  2. Verify directory is gitignored
  3. Create worktree with new branch
  4. Run project setup (auto-detect npm/cargo/pip/go)
  5. Verify clean test baseline
  6. Report ready

Safety

  • Always verify worktree directory is gitignored
  • Always run baseline tests
  • Report failures before proceeding

Agents Used

  • Process agents referenced in superpowers-workflow.js

Tool Use

Referenced by executing-plans and subagent-driven-development processes.

Source

git clone https://github.com/a5c-ai/babysitter/blob/main/plugins/babysitter/skills/babysit/process/methodologies/superpowers/skills/using-git-worktrees/SKILL.mdView on GitHub

Overview

Using Git Worktrees, this skill creates isolated workspaces sharing the same repository. It uses systematic directory selection and safety verification to protect your main workspace. The core principle is to establish an isolated workspace before implementation.

How This Skill Works

The process starts by checking existing worktrees in .worktrees/ or worktrees/, then verifies the target directory is gitignored. It creates a new worktree on a feature branch, runs project setup with automatic detection of npm/cargo/pip/go, and finally verifies a clean test baseline before reporting readiness.

When to Use It

  • Starting a feature branch that must run in isolation from the current workspace.
  • Before executing implementation plans to avoid contaminating the main working tree.
  • Experimenting with risky changes or refactors in a contained environment.
  • Working in multi-language repos (npm, cargo, pip, go) where setup varies.
  • Establishing a clean baseline by first running tests in the isolated worktree before integration.

Quick Start

  1. Step 1: Check for existing worktrees in .worktrees/ or worktrees/ to pick a safe path.
  2. Step 2: Ensure the intended directory is gitignored to avoid accidental commits.
  3. Step 3: Create a new git worktree on a feature branch, then run the project setup (auto-detecting npm/cargo/pip/go) and verify a clean test baseline.

Best Practices

  • Always check for existing worktrees to avoid conflicts.
  • Verify the target directory is gitignored to prevent leaks.
  • Create the new worktree on a dedicated feature branch.
  • Run project setup with automatic tool detection (npm/cargo/pip/go).
  • Run baseline tests and report any failures before proceeding.

Example Use Cases

  • Create a worktree for a Node.js feature, install dependencies, and run tests without touching the main workspace.
  • Isolate a Rust cargo feature by creating a worktree on a feature branch and running cargo test.
  • In a Python project, establish a worktree, set up the environment automatically, and validate with tests.
  • For a Go module, create a worktree to implement a feature and execute go test in isolation.
  • In a monorepo with multiple services, isolate changes to a single service to prevent cross-service interference.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers