using-git-worktrees

Create isolated Git worktrees for feature development with automatic directory selection.

2|1|Updated Jan 5, 2026
One-click install
npx skills add https://github.com/lagz0ne/prev-cli --skill using-git-worktrees-lagz0ne
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/lagz0ne/prev-cli/tree/main/.opencode/skill/using-git-worktrees
Command: npx skills add https://github.com/lagz0ne/prev-cli --skill using-git-worktrees-lagz0ne

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill enables developers to create isolated Git workspaces via worktrees, protecting the current working directory from concurrent feature work.

Core Features & Use Cases

  • Create and switch to isolated worktrees for a given branch.
  • Safely verify and enforce .gitignore rules before creating a local worktree.
  • Offer a preferred directory selection order and optionally detect project name for global worktree locations.

Quick Start

  • Ask the skill to create an isolated workspace for feature development, selecting .worktrees first if available, verify gitignore, and set up the project environment.

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 from my current Git working directory?

Git worktrees isolate feature development by creating separate working directories linked to the same repository, protecting your current workspace from concurrent branch changes. This approach allows independent branch work without stashing or cloning.

What is the best way to set up a Git worktree for a new feature branch?

Setting up a Git worktree involves detecting the project root, selecting a preferred directory like .worktrees, verifying .gitignore rules, and optionally running project setup commands. This process safely creates an isolated workspace for your feature branch.

Does Git worktree creation verify .gitignore rules before switching branches?

Git worktree creation verifies .gitignore rules before switching branches to ensure safety. The workflow checks ignore configurations and enforces them prior to establishing a local worktree, preventing unwanted files from entering the isolated environment.

Can I choose between local and global locations when creating a Git worktree?

You can choose between local and global locations for Git worktrees. The setup detects the project name to determine placement, applying an automatic directory selection order that prefers local .worktrees before falling back to global worktree locations.

When do I need to run optional project setup commands in a Git worktree?

Optional project setup commands run after creating a Git worktree to prepare the isolated environment for development. You need these commands when starting new features or experiments that require dependency installation or environment configuration before coding begins.

Why use Git worktrees instead of cloning a repository for parallel feature work?

Git worktrees provide isolated working directories sharing a single repository history, avoiding the disk overhead and history duplication of cloning. They allow safe parallel feature development and experiments without stashing changes or disrupting the current workspace.