using-git-worktrees

Create isolated git worktrees and check out feature branches.

Updated Mar 7, 2026
One-click install
npx skills add https://github.com/randoneering/nix-flake-mirror --skill using-git-worktrees-randoneering
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/randoneering/nix-flake-mirror/tree/main/home/programs/opencode/skills/using-git-worktrees
Command: npx skills add https://github.com/randoneering/nix-flake-mirror --skill using-git-worktrees-randoneering

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Helps developers create isolated git workspaces via worktrees to keep feature work separate from the main branch.

Core Features & Use Cases

  • Auto-detects project context and selects an appropriate worktree directory (.worktrees, worktrees, or a global path).
  • Verifies that the worktree directory is ignored by gitignore to prevent accidental commits of worktree contents.
  • Creates a new worktree and checks out the target branch.
  • Runs project setup commands automatically when relevant (e.g., npm, cargo, go) to bootstrap the worktree.
  • Reports status and location when ready.

Quick Start

Ask me to set up an isolated git worktree for your current repository and a new feature 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 create an isolated git worktree for a new feature branch?

To create an isolated git worktree, the system detects your project context, selects an appropriate directory, verifies gitignore safety, checks out the target branch, and runs setup commands automatically. This keeps feature work separate from your main workspace.

What is a git worktree and when do I need one?

A git worktree is an isolated workspace linked to your repository that lets you work on multiple branches simultaneously. You need a git worktree when starting feature work or safely testing changes without affecting your main branch's working directory.

How do I prevent accidental commits of worktree contents in git?

To prevent accidental commits of worktree contents, the setup verifies that the selected worktree directory is properly ignored by your project's gitignore configuration before creating the worktree and checking out the branch.

Can I use a global directory instead of a project-local worktree?

Yes, you can use a global directory instead of a project-local worktree. The setup supports both project-local paths like .worktrees or worktrees, and global locations, automatically detecting context and selecting an appropriate directory.

Does the worktree setup run project bootstrapping commands automatically?

Yes, the worktree setup runs project bootstrapping commands automatically. When relevant, it detects and executes setup commands like npm, cargo, or go to bootstrap the new worktree environment after checking out the branch.

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

The best way to manage multiple git branches for parallel development is using isolated git worktrees. This approach creates separate working directories for each branch, allowing you to experiment and test changes safely without switching branches in your main workspace.