agentleFS
sergeeeysergeeey/Claude-cod-top-2026/skills/core/git-worktrees/SKILL.md

git-worktrees

Skill9 starsChanged 7 months agoMITView on GitHub

Rule: worktree = recommendation, not mandate. Regular branch covers 80% of cases. Claude Code has a built-in EnterWorktree tool: - Automatically creates a worktree in a sibling directory - Switches context to the new tree - After completion — merge and cleanup When to use EnterWorktree: 1. Plan contains 5+ steps with high risk of cascading errors 2. User asks to "try it, but keep rollback possible" 3. Parallel task while current one is unfinished

12 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use workflow-orchestration, observability and 6 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • shyamsridhar123Skill

    workflow-orchestration

    Build multi-agent workflows and graph-based orchestration using Microsoft Agent Framework. Use this skill when creating agent pipelines, connecting multiple agents, implementing human-in-the-loop patterns, streaming, checkpointing, or time-travel debugging.

    Also in 3 projects that use this

  • OpenAISkill

    observability

    Vercel Observability expert guidance — Drains (logs, traces, speed insights, web analytics), Web Analytics, Speed Insights, runtime logs, custom events, OpenTelemetry integration, and monitoring dashboards. Use when instrumenting, debugging, or optimizing application performance and user experience on Vercel.

    Also in 3 projects that use this

  • OpenAISkill

    executing-plans

    Use when you have a written implementation plan to execute in a separate session with review checkpoints

    Also in 4 projects that use this

  • ElasticSkill

    create-skill

    Interactively create a new Claude Code skill and add it to the elastic-docs-skills catalog. Use when the user wants to generate a new skill, scaffold a slash command, or build automation for docs tasks.

    Also in 3 projects that use this

  • +4 more from openai

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 12 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    USE when needing isolated workspace for experiments or parallel development.

    line 12
  2. Distinctive:

    After completion — merge and cleanup

    line 82
  3. Distinctive:

    Always git stash before creating worktree if you have uncommitted changes

    line 101

“Common” is measured: kept by at least 6 in 10 of the 12 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md
<!-- BSV — Brief Skill View | поиск: BSV Скил : git-worktrees TL;DR : Изолированные ветки без переключения контекста Вызов : 'worktree', 'изолируй ветку' НЕ для : Работа в одной ветке -->

name: git-worktrees description: > [STATUS: review] [CONFIDENCE: high] [REVIEWED: 2026-03-13] USE when needing isolated workspace for experiments or parallel development. Triggers: worktree, experiment, parallel branch, isolated copy, isolated branch, parallel work.

Skill: Git Worktrees

When to Load

  • Experiment with uncertain outcome (may require rollback)
  • Parallel work on 2+ tasks
  • Large refactor while needing to keep a working version

Principle

Worktree = isolated working copy. Cheaper than stash/switch, safer than working in one tree.


Decision Matrix: branch vs worktree

SituationBranchWorktreeWhy
Bug fix in 1-2 filesvWorktree overhead not justified
Experiment (may not be needed)vClean rollback = delete the folder
Parallel work (2 tasks)vNo stash/switch needed
Large refactor 5+ filesvMain branch stays working
Regular feature 3-5 filesvWorktree = overkill
CI/CD check on another branchvDoes not interrupt current work

Rule: worktree = recommendation, not mandate. Regular branch covers 80% of cases.


Workflow

1. Create worktree

# EnterWorktree creates a worktree automatically (Claude Code built-in)
# Or manually:
git worktree add ../project-experiment feature/experiment
cd ../project-experiment

2. Work in worktree

  • Worktree = full working copy with a separate HEAD
  • Can work in parallel in main tree and worktree
  • Commits in the worktree go to their own branch

3. Merge result

# From the main tree:
git merge feature/experiment
# Or cherry-pick specific commits:
git cherry-pick <commit-hash>

4. Cleanup

git worktree remove ../project-experiment
# Or if branch is no longer needed:
git worktree remove ../project-experiment
git branch -d feature/experiment

Claude Code Integration

Claude Code has a built-in EnterWorktree tool:

  • Automatically creates a worktree in a sibling directory
  • Switches context to the new tree
  • After completion — merge and cleanup

When to use EnterWorktree:

  1. Plan contains 5+ steps with high risk of cascading errors
  2. User asks to "try it, but keep rollback possible"
  3. Parallel task while current one is unfinished

Anti-patterns

Don't doWhy
Worktree for every minor editOverhead > benefit
Forgetting cleanup after mergeDead directories accumulate
Working in worktree without a branchDetached HEAD = lost commits
Multiple worktrees on one branchGit won't allow it (and rightly so)

Gotchas

  • Always git stash before creating worktree if you have uncommitted changes
  • Worktree cleanup is manual — delete the directory when done

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.