using-git-worktrees

Creates isolated git worktrees with project setup and baseline verification before feature development.

Updated Jun 18, 2026
One-click install
npx skills add https://github.com/hugefiver/ocmm --skill using-git-worktrees-hugefiver
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: using-git-worktrees
Source: https://github.com/hugefiver/ocmm/tree/main/plugins/deepwork/skills/using-git-worktrees
Command: npx skills add https://github.com/hugefiver/ocmm --skill using-git-worktrees-hugefiver

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Developers often need to work on a feature branch without disturbing their main working tree, but stashing, switching, and re-installing dependencies is error-prone. This Skill creates a linked git worktree as a sibling checkout, sets up the project inside it, and verifies a clean build and test baseline before any feature work begins. ## Core Features & Use Cases - Consent-gated worktree creation: Activates only when the user explicitly asks for a worktree, and detects whether you are already inside a linked worktree or a submodule before creating anything. - Guided setup flow: Runs git worktree add -b <branch> <path> as a sibling of the main repo, then re-installs dependencies (pnpm, Cargo, Python, Go) inside the fresh checkout. - Baseline verification: Confirms the branch, clean git status, typecheck, and tests pass before development starts, so pre-existing failures are not confused with new changes. - Use Case: A user asks to build a feature in a worktree; the Skill creates ../repo-wt-feature-x on a new branch, runs pnpm install, verifies pnpm test passes, and later cleans up with git worktree remove once merged. ## Quick Start Ask the assistant to create a git worktree for your new feature branch and verify the project builds and tests pass inside it before starting 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 a git worktree for a new feature branch?▼

Run `git worktree add -b <branch> <path>` from the repository root, placing the worktree as a sibling directory of the main repo. Then reinstall dependencies inside the worktree and verify the build and tests pass before starting work.

How do I check if I am already inside a git worktree?▼

Compare `git rev-parse --git-dir` with `git rev-parse --git-common-dir`. If the two paths differ, you are inside a linked worktree and should not create a nested one.

Can I create a git worktree inside a submodule?▼

Worktrees inside git submodules are unreliable and should be avoided. Check with `git rev-parse --show-toplevel` and verify the top-level directory is not listed in `.gitmodules` before creating a worktree.

Why does my build fail inside a new git worktree?▼

A worktree is a fresh checkout that does not share `node_modules`, build artifacts, or lockfile-generated output with the main tree. Re-run project setup such as `pnpm install` inside the worktree before building.

How do I remove a git worktree after merging?▼

From the main repository root, run `git worktree remove <path>` and then delete the branch with `git branch -d <branch>` if merged. Use `git worktree prune` to clean stale worktree metadata.