worktree

Create or attach git worktrees for parallel feature branches.

3|Updated Sep 20, 2021
One-click install
npx skills add https://github.com/jinyuanlu/dotfiles --skill worktree-jinyuanlu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: worktree
Source: https://github.com/jinyuanlu/dotfiles/tree/main/.claude/skills/worktree
Command: npx skills add https://github.com/jinyuanlu/dotfiles --skill worktree-jinyuanlu

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill streamlines working on multiple features in parallel by creating isolated git worktrees so developers can work on separate feature branches without switching a single main checkout or causing local conflicts.

Core Features & Use Cases

  • Ensures the repository is up to date by fetching from origin before creating worktrees.
  • Validates and updates .gitignore to include .worktrees to avoid committing local worktree directories.
  • Detects whether a feat/<name> branch already exists and either attaches a worktree to the existing branch or creates a new branch from origin/develop or origin/master.
  • Useful for feature development, reviewer workflows, and running multiple environments or tests concurrently without interfering with the primary working directory.

Quick Start

Invoke the skill with a branch name, for example: /worktree auth-refactor to create or attach a worktree for that feature.

Frequently Asked Questions about worktree

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

FAQPage Schema
How do I create an isolated git worktree for parallel feature development?

To create an isolated git worktree, the skill fetches from origin, ensures .worktrees is in .gitignore, and runs git worktree add to create or attach a worktree for parallel feature development.

How does git worktree handle existing feature branches?

Git worktree detects whether a feat/<name> branch already exists and either attaches a new worktree to the existing branch or creates a new branch from origin/develop or origin/master.

What is the best way to work on multiple git branches without switching checkouts?

The best way to work on multiple git branches without switching checkouts is using git worktrees to create isolated local development directories for concurrent feature development and testing.

Does creating a git worktree automatically update .gitignore?

Yes, creating a git worktree automatically validates and updates .gitignore to include the .worktrees directory, preventing local worktree folders from being accidentally committed to the repository.

Can I run multiple test environments concurrently using git worktrees?

Yes, you can run multiple test environments concurrently using git worktrees because they provide isolated local development directories that allow testing separate feature branches without interfering with the primary working directory.

Do I need to fetch from origin before adding a new git worktree?

Yes, you need to fetch from origin before adding a new git worktree because the skill ensures the repository is up to date by fetching from origin before creating or attaching the worktree to the selected base branch.