using-git-worktrees

Create isolated Git worktrees on feature branches with automatic project setup.

Updated Aug 20, 2022
One-click install
npx skills add https://github.com/Neroro64/dotfiles --skill using-git-worktrees-neroro64
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/Neroro64/dotfiles/tree/main/configs/omp/agent/skills/using-git-worktrees
Command: npx skills add https://github.com/Neroro64/dotfiles --skill using-git-worktrees-neroro64

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Set up isolated Git worktrees to safely experiment on new features without disturbing the main workspace.

Core Features & Use Cases

  • Directory selection: prioritizes project-local .worktrees, then worktrees, with a fallback to a global location.
  • Safety verification: checks that the chosen worktree is ignored by git, and updates .gitignore if needed to prevent accidental commits.
  • Automatic setup: detects the project name, creates a new worktree on a feature branch, and runs common setup steps (language/tool-specific as detected by project files).

Quick Start

Create a new feature worktree in the preferred location, switch to it with a new branch, and run the project setup steps.

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 main Git workspace?

To isolate feature development from your main Git workspace, you can set up isolated Git worktrees that safely experiment on new features without disturbing the main working directory.

How do I create a Git worktree on a new feature branch?

To create a Git worktree on a new feature branch, the setup process detects your project name, creates the worktree in a chosen directory, and automatically runs common project setup steps like installing language-specific dependencies.

Where should I store my Git worktrees to prevent accidental commits?

Git worktrees should be stored in project-local hidden directories like .worktrees or a global fallback location. The setup verifies the chosen path is ignored by Git and updates .gitignore if needed to prevent accidental commits.

Does setting up Git worktrees require manually updating .gitignore?

Setting up Git worktrees does not require manually updating .gitignore. The setup includes safety verification that checks if the worktree is ignored and automatically updates .gitignore if needed.

What is the best way to automatically run project setup steps in a new Git worktree?

The best way to automatically run project setup steps in a new Git worktree is using a setup process that detects project files, creates the worktree on a feature branch, and executes the detected language or tool-specific setup steps.