using-git-worktrees

Create isolated Git worktrees for feature development with automatic setup.

4|Updated Dec 7, 2020
One-click install
npx skills add https://github.com/charly3pins/dotfiles --skill using-git-worktrees-charly3pins
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/charly3pins/dotfiles/tree/main/.config/opencode/skills/using-git-worktrees
Command: npx skills add https://github.com/charly3pins/dotfiles --skill using-git-worktrees-charly3pins

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Working on multiple features or branches simultaneously can lead to context switching overhead and accidental changes, disrupting workflow and introducing errors.

Core Features & Use Cases

  • Isolated Workspaces: Creates separate Git worktrees, allowing concurrent work on multiple branches without interference.
  • Smart Directory Selection: Systematically chooses worktree locations based on existing directories or project conventions.
  • Safety Verification: Ensures .gitignore is correctly configured to prevent accidental commits of worktree contents.
  • Use Case: Before starting a new feature that requires an isolated development environment, use this skill to create a dedicated Git worktree, ensuring a clean and conflict-free workspace.

Quick Start

I need to start work on a new feature branch. Use the git-worktrees skill to set up an isolated workspace for me.

Frequently Asked Questions about using-git-worktrees

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

FAQPage Schema
How do I work on multiple Git branches without switching workspaces?

Git worktrees create isolated workspaces for each branch, letting you develop multiple features simultaneously without context switching. Each worktree has its own directory and checked-out branch, keeping changes separate and preventing accidental interference between features.

What's the best way to prevent conflicts when working on multiple features at once?

Use git worktrees to isolate each feature in a dedicated workspace. This eliminates merge conflicts from concurrent edits in the same directory and keeps your primary workspace clean while you develop on separate branches.

How do I set up a Git worktree with automatic project dependencies?

Git worktrees automatically detect your project type—npm, Cargo, Python, Go—and run setup commands like npm install or cargo build. The skill verifies .gitignore configuration and validates a clean baseline with tests before you start development.

Can I use Git worktrees to avoid modifying my main working directory?

Yes. Worktrees create completely isolated directories for each branch, leaving your main workspace untouched. You can continue working on one feature while exploring or testing others in separate worktrees.

Does Git worktree setup require manual configuration of my project environment?

No. The skill automatically detects project tooling and handles setup for npm, Cargo, pip, poetry, and Go. It also verifies .gitignore entries to ensure worktree contents won't be accidentally committed.

When should I use Git worktrees instead of just switching branches?

Use worktrees when you need to maintain multiple branches checked out simultaneously without rebuilding dependencies or disrupting tests. Branch switching requires stashing changes and rebuilding; worktrees keep everything ready and isolated.