using-git-worktrees

Create isolated git worktrees for feature branches with ignore verification.

3|Updated May 31, 2024
One-click install
npx skills add https://github.com/hugo-berendi/yomi --skill using-git-worktrees-hugo-berendi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/hugo-berendi/yomi/tree/main/.opencode/skills/using-git-worktrees
Command: npx skills add https://github.com/hugo-berendi/yomi --skill using-git-worktrees-hugo-berendi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Developers often need to work on new features or experiments without contaminating the main workspace. This Skill provides a safe, isolated git worktree workflow that creates dedicated worktrees for feature branches and ensures isolation from the primary development environment.

Core Features & Use Cases

  • Isolated workspaces: Create per-feature worktrees that share the same repository but point to different branches.
  • Automatic directory selection: Prioritize project-local directories (.worktrees, then worktrees) and offer a fallback based on CLAUDE.md or user input.
  • Safety verification: Ensure the chosen worktree directory is ignored by git to prevent accidental commits; if not ignored, guide fixes to .gitignore and commit.
  • Automatic project bootstrap: Detect the project name, create the worktree with the new branch, and enter the new workspace for immediate work.

Quick Start

Create an isolated git worktree for a new feature branch BRANCH_NAME, using the project-local .worktrees directory when available, and verify the directory is ignored by git before proceeding.

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 skill detects your project name, creates a dedicated worktree with a new branch, and enters the workspace for immediate work. It prioritizes project-local directories like .worktrees or worktrees.

Why does my git worktree directory need to be in .gitignore?

Your git worktree directory must be ignored to prevent accidental commits of nested repositories. The skill verifies this using git check-ignore and guides you through updating .gitignore if the directory is not ignored.

What is the best way to isolate feature development from my main workspace?

Isolating feature development is best achieved by creating per-feature git worktrees that share the repository but point to different branches. This prevents workspace contamination and keeps experiments separate.

Can I use git worktrees for bug fixes and experiments without disrupting the main branch?

Yes, git worktrees are applicable when starting new features, experiments, or bug fixes. They provide safe, isolated workspaces that allow you to develop without disrupting the primary development environment.

How does directory selection work when creating a worktree?

Directory selection prioritizes project-local directories, checking for .worktrees first, then worktrees. If neither exists, it offers a fallback based on CLAUDE.md or user input to ensure proper isolation.

What happens if my chosen worktree directory is not ignored by git?

If the chosen worktree directory is not ignored by git, the skill guides you through fixing the .gitignore file and committing the change. This safety verification ensures your worktree remains isolated.