using-git-worktrees

Create isolated git worktrees with safety checks and automatic project setup.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/lightxue/dotfiles --skill using-git-worktrees-lightxue
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/lightxue/dotfiles/tree/main/agent/skills/using-git-worktrees
Command: npx skills add https://github.com/lightxue/dotfiles --skill using-git-worktrees-lightxue

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps engineers create isolated, repeatable workspaces for feature development by using Git worktrees and enforcing safety checks, preventing accidental changes to the main workspace.

Core Features & Use Cases

  • Directory selection follows a clear priority: prefer existing .worktrees, then worktrees, then project configuration, otherwise prompt the user.
  • Safety verification ensures the chosen directory is ignored by git before creating a worktree.
  • Automatic project setup detects common project files (package.json, Cargo.toml, requirements.txt, pyproject.toml) and runs appropriate setup steps.
  • Flexible location options support both project-local and global worktree directories.
  • Use Case: Start a feature work in isolation without disrupting the main branch, and automatically verify baseline tests after creation.

Quick Start

Create a new isolated git worktree for the current project on a feature branch 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 an isolated git worktree for feature development?

Creating an isolated git worktree involves checking out a feature branch into a separate directory, verifying it is git-ignored, and running project setup steps automatically to ensure a safe, independent workspace.

What is the best way to manage multiple git branches without disrupting the main workspace?

Using git worktrees is the best way to manage multiple branches, as it creates isolated directories for each feature, preventing accidental changes to the main workspace while allowing concurrent development.

How does automatic project setup work when creating a new git worktree?

Automatic project setup detects common project files like Cargo.toml, pyproject.toml, package.json, or requirements.txt within the new git worktree and runs the appropriate setup steps to prepare the isolated environment.

Can I use a global directory instead of a project-local .worktrees folder for git worktrees?

Yes, you can use a global directory for git worktrees. The skill supports both project-local .worktrees folders and global locations, prioritizing existing directories before prompting you for a new path.

How do I ensure my git worktree directory is safely ignored from version control?

To ensure your git worktree directory is safely ignored, the skill runs git check-ignore verification before creation, guaranteeing the chosen directory is properly excluded from version control tracking.

Does creating a git worktree run baseline tests automatically after project setup?

Yes, creating a git worktree includes post-creation validation that runs baseline tests after the automatic project setup, verifying the isolated feature branch environment is fully functional before development begins.