using-git-worktrees

Create isolated Git worktrees with safety verification and automatic project setup.

Updated Apr 16, 2014
One-click install
npx skills add https://github.com/minhhh/dotfiles --skill using-git-worktrees-minhhh
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/minhhh/dotfiles/tree/main/ai/.ai/gemini-superpowers/skills/using-git-worktrees
Command: npx skills add https://github.com/minhhh/dotfiles --skill using-git-worktrees-minhhh

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Create isolated Git workspaces to allow feature development without disturbing the main repository, ensuring safe isolation and repeatable baselines.

Core Features & Use Cases

  • Directory-priority based workspace selection (.worktrees, worktrees) with fallback to global paths.
  • Safety verification to ensure worktrees are ignored by git, preventing accidental commits of worktree content.
  • Auto-detects the project name, creates a new worktree, checks out a feature branch, and runs project setup commands automatically when applicable.

Quick Start

Create a new isolated worktree for the current project and run the project setup automatically.

Frequently Asked Questions about using-git-worktrees

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

FAQPage Schema
How do I create isolated Git workspaces for feature development?

To create isolated Git workspaces, you can use Git worktrees to establish separate working directories for your project. This allows feature work without affecting the main repository, ensuring safe isolation and repeatable baselines.

What's the best way to automate project setup when adding a Git worktree?

Automating project setup during Git worktree creation involves auto-running setup commands based on detected project files. This ensures the new isolated workspace has dependencies installed and is configured correctly immediately after checkout.

How does Git worktree directory selection work for project-local and global paths?

Git worktree directory selection uses priority-based logic, checking for local directories like `.worktrees` or `worktrees` first. If these are unavailable, it falls back to global paths to deterministically place the isolated workspace.

How do I prevent accidental commits of Git worktree content?

To prevent accidental commits of Git worktree content, you need safety verification to ensure worktree directories are ignored by Git. This involves checking and applying ignore rules before the worktree is fully initialized.

When should I use Git worktrees instead of cloning a repository?

Git worktrees are ideal when you need to isolate feature work without the disk overhead of a full clone. They allow you to work on multiple branches simultaneously from a single repository, maintaining safe isolation and repeatable baselines.

Can I auto-detect the project name when creating a new worktree?

Yes, the worktree creation process can auto-detect the project name to automatically name the new workspace. It then creates the worktree, checks out a feature branch, and runs project setup commands based on project files.