git-worktree

Teaches agents correct git behavior inside .tasks worktree environments.

1|Updated Jun 1, 2026
One-click install
npx skills add https://github.com/D1ssolve/craft-agents --skill git-worktree-d1ssolve
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-worktree
Source: https://github.com/D1ssolve/craft-agents/tree/main/skills/git-worktree
Command: npx skills add https://github.com/D1ssolve/craft-agents --skill git-worktree-d1ssolve

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Agents working in git worktree setups often run git commands in the wrong directory, accidentally operate on the main repository, or fail because the task root has no .git directory. This Skill injects worktree awareness so agents operate only in the correct checkout. ## Core Features & Use Cases - Dual-Mode Context: Distinguishes between the task root (no git repository, multiple service worktrees) and inside a worktree (where .git is a file pointing to the main repo). - Safety Rules: Enforces constraints such as never cd-ing to the main repository path and never checking out a branch already used by another worktree. - Cross-Service Coordination: Explains how to reference sibling services by full path when a task spans multiple repositories. - Use Case: When working in .tasks/ITPR-492/inbanksight/, the agent knows it is on a task-specific branch, runs git commands locally, and never touches the main repository checkout. ## Quick Start Ask the agent to commit the current changes in the active worktree without touching the main repository.

Frequently Asked Questions about git-worktree

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

FAQPage Schema
How do I run git commands inside a git worktree?

Run git commands normally inside the worktree directory, where .git is a file pointing to the main repository. Commands like git add, commit, push, pull, diff, and log work identically to a standard checkout.

Why do git commands fail in the .tasks task root folder?

The task root folder contains no .git directory, so git commands fail there. You must cd into a specific service worktree subdirectory or use a workdir parameter before running any git operation.

Can two git worktrees check out the same branch?

No, git refuses to check out the same branch in multiple worktrees simultaneously. Create a new branch with git checkout -b instead of switching to a branch already checked out elsewhere.

How do I list all worktrees for a git repository?

Run git worktree list inside any worktree to see all checkouts and their branches. Use git worktree list --porcelain for machine-readable output, and git worktree prune to clean stale entries.

When does the git-worktree skill activate?

It auto-activates when the current directory is a .tasks/<TASK_ID> folder with worktree subdirectories, when .git is a file rather than a directory, or when the path matches the */.tasks/*/ pattern.