using-git-worktrees

Create isolated Git worktrees with directory selection and safety verification.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill streamlines the process of creating isolated development environments using Git worktrees, ensuring a clean separation from your main codebase and preventing accidental commits to the wrong branch.

Core Features & Use Cases

  • Isolated Workspaces: Create separate directories for different branches, allowing simultaneous work without context switching.
  • Smart Directory Selection: Intelligently chooses where to create worktrees based on project conventions or user preference.
  • Safety Verification: Ensures project-local directories are ignored by Git before creation to prevent pollution.
  • Automated Setup: Detects and runs project-specific setup commands (e.g., npm install, cargo build).
  • Baseline Testing: Verifies a clean state by running tests after setup.
  • Use Case: Before starting a new feature, use this skill to create a dedicated worktree for it, ensuring your main branch remains untouched and stable.

Quick Start

Use the using-git-worktrees skill to create a new worktree for the 'feature/user-auth' branch.

Frequently Asked Questions about using-git-worktrees

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

FAQPage Schema
How do I isolate feature development work using git worktrees?

Git worktrees isolate feature development by creating separate directories for different branches, allowing simultaneous work without context switching. This prevents accidental commits to the wrong branch and keeps your main codebase stable.

What's the best way to manage multiple git branches for parallel development?

Managing multiple git branches for parallel development is best handled by creating isolated workspaces. This approach enables simultaneous work on separate branches, preventing context switching and ensuring your main branch remains untouched.

Does git worktree creation respect my .gitignore settings?

Yes, git worktree creation respects `.gitignore` settings. Safety verification ensures project-local worktree directories are ignored by Git before creation, preventing directory pollution and maintaining a clean repository structure.

Can I automate project setup and baseline testing when creating a git worktree?

You can automate project setup and baseline testing when creating a git worktree. The process detects and runs project-specific setup commands like `npm install` or `cargo build`, then verifies a clean state by running tests.

How does intelligent directory selection work for git worktrees?

Intelligent directory selection for git worktrees automatically chooses where to create isolated workspaces based on project conventions or user preference. It manages both project-local and global worktree locations for optimal organization.

Why should I use git worktrees instead of switching branches in my main directory?

Git worktrees provide a clean separation from your main codebase, preventing accidental commits to the wrong branch. Unlike switching branches in a single directory, worktrees allow simultaneous work on multiple branches without losing your current development context.