using-git-worktrees

Create isolated git worktrees with directory selection and safety verification.

Updated Apr 16, 2026
One-click install
npx skills add https://github.com/HadiCherkaoui/opencode-config --skill using-git-worktrees-hadicherkaoui
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/HadiCherkaoui/opencode-config/tree/main/skills/using-git-worktrees
Command: npx skills add https://github.com/HadiCherkaoui/opencode-config --skill using-git-worktrees-hadicherkaoui

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Starting feature work that must be isolated from the current workspace, this skill creates and manages isolated git worktrees with smart directory selection and safety verification.

Core Features & Use Cases

  • Directory selection and safe creation: prefers existing local worktrees, then CLAUDE.md hints, otherwise prompts for a location
  • Safety verification: ensures the chosen directory is ignored by git to prevent accidental commits of worktree contents
  • End-to-end workflow: detects project name, creates the worktree, runs project setup commands, and validates a clean baseline
  • Automation readiness: auto-detects setup steps (npm, cargo, pip, etc.) where applicable

Quick Start

Create an isolated git worktree for a feature branch, verify it is ignored by gitignore rules, set up the project, and prepare for development.

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 feature development?

Creating an isolated git worktree involves selecting a safe directory via CLAUDE.md hints or prompts, verifying it is ignored by git, creating the branch, and running automated project setup commands to prepare for development.

What is the safest way to set up a git worktree without affecting the main branch?

The safest way to set up a git worktree is using exclusive safety checks that ensure the chosen directory is ignored by gitignore rules, preventing accidental commits of worktree contents back to the main branch.

How does automated project setup work when creating a git worktree?

Automated project setup detects the project stack and runs relevant setup commands like npm, cargo, or pip automatically after the git worktree is created, validating a clean baseline for development.

Can I use CLAUDE.md hints to specify where my git worktree should be located?

Yes, you can use CLAUDE.md hints to specify your git worktree location. The skill prefers existing local worktrees first, then checks CLAUDE.md hints, and finally prompts for a location if needed.

Why should I verify that my worktree directory is ignored by gitignore rules?

You must verify your worktree directory is ignored by gitignore rules to enforce safety and prevent accidental commits of worktree contents into the main repository, ensuring clean branch management.

Does git worktree creation support typical project stacks like npm, cargo, and pip?

Yes, git worktree creation supports typical project stacks. The skill auto-detects setup steps for package managers like npm, cargo, and pip where applicable, running them to validate a clean baseline.