subset-worktree

Creates a git worktree materializing only selected folders via cone-mode sparse-checkout.

2|1|Updated Jun 23, 2026
One-click install
npx skills add https://github.com/Kaidanov/grekai-skills-4all --skill subset-worktree-kaidanov
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: subset-worktree
Source: https://github.com/Kaidanov/grekai-skills-4all/tree/main/skills/my-claude-toolkit/skills/subset-worktree
Command: npx skills add https://github.com/Kaidanov/grekai-skills-4all --skill subset-worktree-kaidanov

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Checking out an entire large monorepo just to work on one sub-area wastes disk space and time. This Skill creates a git worktree that materializes only the folders you need (e.g. WebApi plus its tests and docs) using cone-mode sparse-checkout, while keeping full git functionality like history, commit, and push. ## Core Features & Use Cases - Sparse worktree creation: Runs a PowerShell engine script that adds a worktree with --no-checkout, configures cone-mode sparse-checkout for named folders, and populates only those directories. - Auto-detection of changed folders: When folders are omitted, it diffs the branch against a base branch (default origin/dev) over the merge-base to find changed top-level directories. - Version verification: Greps AssemblyVersion and <Version> stamps under the materialized folders and warns when none match the expected release version. - Use Case: Pull only the WebApi, WebApiDocs, and test folders of a 2 GB solution into a separate folder like MyApp_1.2.3_webapi to verify a release line, reducing the checkout to a few megabytes. ## Quick Start Ask the assistant to create a sparse worktree of your branch containing only the WebApi and test folders into a new destination folder, and verify it is stamped with the expected version.

Frequently Asked Questions about subset-worktree

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

FAQPage Schema
How do I create a git worktree with only some folders?

Add the worktree with `git worktree add --no-checkout`, then run `git sparse-checkout init --cone` and `git sparse-checkout set` with the folder names, followed by `git checkout`. The included PowerShell script automates this entire sequence.

How to check out only changed folders of a branch in a monorepo?

Diff the branch against its merge-base with a base branch using `git diff --name-only`, take the top-level directory of each changed path, and pass those folders to sparse-checkout. The script does this automatically when the Folders parameter is omitted.

Does sparse-checkout delete files from the branch?

No, sparse-checkout only hides files from the working directory on disk. The branch and its commits remain intact, and history, commit, and push all work normally inside the sparse worktree.

How do I verify a worktree is on a specific release version?

Check that the release branch is an ancestor with `git merge-base --is-ancestor`, and inspect the AssemblyVersion or Version stamp in the project files. The script greps these stamps and warns when none match the expected version.

What happens if the destination folder already exists?

If the destination is already a registered worktree, the script re-applies the sparse set idempotently. If it exists but is not a registered worktree, the script stops and requires the Force flag to remove and recreate it.