Command Palette

Search for a command to run...

Назад к скиллам
скилл № 26701

ia-git-worktree

Manage Git worktrees for isolated parallel development. Use when creating, listing, switching, or cleaning up git worktrees, or when needing isolated branches…

БесплатноБез исполняемых скриптов
iliaalот iliaal★ 37 звёзд на GitHub

Установить ia-git-worktree в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

Git worktree manager

GATE: If the task runs inside an existing worktree (a worktree path is given and no create/remove/switch is requested), none of the creation flow applies: work in place and skip this skill. To check: git rev-parse --show-toplevel appears as a linked entry in git worktree list.

Working rules

  • Preserve other sessions' branches, files, and staged work (see Ownership).
  • Verify dependencies resolve first-party code from the intended worktree.
  • Keep merge, push, and cleanup within user authorization; report the exact exercised checkout and resulting commit.

Create worktrees with this procedure

Create every worktree with the steps below, not an ad hoc git worktree add. Record each tree this session creates; only those trees are this session's to clean up.

  1. Choose the path. Use .worktrees/<name> under the main checkout. Confirm it is ignored: git check-ignore -q -- .worktrees/<name>. If it is not, append .worktrees/ to $(git rev-parse --git-path info/exclude) (never the tracked .gitignore) and re-check. If a project rule still keeps it visible, stop and report the conflict. See hooks-and-excludes.md.

  2. Resolve the base to a commit without touching the caller's checkout. Fetch into a private ref, pin its SHA, then remove the ref:

    fetch_ref="refs/whetstone/fetch/$(date +%s)-$$"
    if GIT_TERMINAL_PROMPT=0 git fetch --no-tags --refmap= origin "<base>:$fetch_ref"; then
      base_sha=$(git rev-parse --verify "$fetch_ref^{commit}")
    else
      base_sha=$(git rev-parse --verify "<base>^{commit}")
    fi
    git update-ref -d "$fetch_ref"
    

    Never check out <base> in the caller's working tree, and do not rely on origin/<base> or FETCH_HEAD, which other checkouts can move. To carry unpushed local commits on <base> into the branch, branch from the local ref deliberately and say so.

  3. Create the tree: git worktree add -b <branch> .worktrees/<name> "$base_sha", then verify git -C .worktrees/<name> rev-parse HEAD equals $base_sha. For an untrusted base (PR heads, fork or origin-only branches, third-party code), run git -c core.hooksPath=/dev/null worktree add ... so checkout hooks do not run.

  4. Environment files (trusted bases only). Copy .env, .env.local, .env.test, and similar files from the main checkout only when the base is the default branch or a local branch that already contains the fetched commit. Never overwrite or follow an existing file or symlink in the new tree (cp -n, after checking with test -L). Never copy them into an untrusted tree.

  5. Dependencies. For trusted bases, install what the project declares: package.json → npm install, composer.json → composer install, pyproject.toml → pip install -e ., go.mod → go mod download. For untrusted bases, skip installs where possible; if one is necessary, disable lifecycle scripts and plugins (npm ci --ignore-scripts, composer install --no-scripts --no-plugins), and do not run pip install -e ., which runs the build backend. Keep credentials out of commands run in that tree.

For a PR review, fetch the head into a review ref (git fetch --no-tags origin "+pull/<n>/head:refs/review/pr-<n>"), pass that ref as <base>, and treat the tree as the PR head only when both the review ref and the new branch equal gh pr view <n> --json headRefOid -q .headRefOid. On a mismatch, review gh pr diff <n> instead and say so in the coverage notes.

Other operations

Operation Command
List git worktree list
Path of a tree git worktree list --porcelain, then the worktree line for the branch; the caller applies it as workdir
Clean up For each named tree this session created: require git -C <tree> status --porcelain --untracked-files=all --ignored=matching to print nothing, confirm with the user, then git worktree remove <tree> from the main checkout

Run commands with env -C "$target" <command> or the harness workdir argument. Run cleanup from the main checkout; inside a linked tree, git rev-parse --show-toplevel returns that linked tree.

Cleanup refuses the current checkout, another session's tree, and any tree with tracked, untracked, or ignored files. Copied .env files and installed dependencies therefore need explicit user-managed disposition first. Confirm no process uses the named trees. Keep Git's removal safeguards, including locked-tree refusal: never pass --force or suppress failures to finish cleanup. Before git worktree prune after a tree ran agent or third-party code, list $(git rev-parse --git-common-dir)/worktrees with ls -la and unlink any symlink there: prune follows planted symlinks and deletes their targets' contents.

A worktree under .worktrees/ is a second checkout inside the repository. Tests that walk the tree with rglob or find see it even though Git excludes hide it; for parallel suites, cr

Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • references/commit-ownership.md
  • references/hooks-and-excludes.md
  • references/worktree-integration.md

FAQ

Что делает скилл ia-git-worktree?

Manage Git worktrees for isolated parallel development. Use when creating, listing, switching, or cleaning up git worktrees, or when needing isolated branches for concurrent reviews or feature work.

Как установить скилл ia-git-worktree?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл ia-git-worktree запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить ia-git-worktree с