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★ 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.
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.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 onorigin/<base>orFETCH_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.Create the tree:
git worktree add -b <branch> .worktrees/<name> "$base_sha", then verifygit -C .worktrees/<name> rev-parse HEADequals$base_sha. For an untrusted base (PR heads, fork or origin-only branches, third-party code), rungit -c core.hooksPath=/dev/null worktree add ...so checkout hooks do not run.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 withtest -L). Never copy them into an untrusted tree.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 runpip 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
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- 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), без исполняемых скриптов.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…