worktree

Create git worktrees with submodule initialization, env copying, and pnpm install.

7.2k|732|Updated Oct 11, 2022
One-click install
npx skills add https://github.com/civitai/civitai --skill worktree-civitai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: worktree
Source: https://github.com/civitai/civitai/tree/main/.claude/skills/worktree
Command: npx skills add https://github.com/civitai/civitai --skill worktree-civitai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Automates the setup of git worktrees for feature branches, eliminating manual steps and ensuring consistent environments across worktrees.

Core Features & Use Cases

  • Create new worktrees for branches under a predictable path and with automatic environment duplication.
  • Initialize submodules and ensure dependencies are installed in the new worktree to match the main repo state.
  • Supports quick experimentation with isolated worktrees while preserving the main worktree integrity for ongoing development.

Quick Start

Create a new worktree for a given branch using the CLI.

Frequently Asked Questions about worktree

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate git worktree creation with submodules and dependency installation?

Automating git worktree creation involves specifying branch handling and path derivation, then initializing submodules, copying environment variables, and running pnpm install to match the main repository state automatically.

What is a git worktree and when do I need isolated environments for feature branches?

A git worktree links a branch to a directory, allowing isolated development. You need isolated worktrees for multi-branch workflows to experiment safely without disrupting the main worktree integrity or ongoing development.

How do I set up a new git worktree from a remote branch with automatic environment duplication?

To set up a new worktree from a remote branch, the system derives a predictable path, initializes submodules, replicates environment configurations from the main repo, and executes pnpm install for dependencies.

Does git worktree setup work with pnpm and project submodules?

Yes, git worktree setup explicitly supports pnpm for dependency installation and automatically initializes submodules within the new worktree to ensure the environment matches the main repository configuration.

What's the best way to manage multiple feature branches without breaking the main development environment?

The best way to manage multiple feature branches is creating isolated git worktrees under predictable paths with automated environment setup, preserving the main worktree integrity for ongoing development.