managing-git-worktrees
БесплатноБез исполняемых скриптовНе проверенDeprecated internal reference for creating, inspecting, attaching, repairing, removing, or pruning local Git worktrees while preserving branches, commits…
от narumiruna★ 19 звёзд на GitHubОб этом скилле
Managing Git Worktrees (Deprecated Reference)
This workflow is excluded from active discovery but retained for repository reference and explicit local compatibility. Inspect before mutation. Keep worktree operations separate from commits, pushes, rebases, and unrelated branch changes. Treat dynamic refs and paths as untrusted: validate them, pass them as argv when possible, and quote shell values.
Inspect
- Capture the invoking worktree, symbolic branch, and HEAD. A detached invoking HEAD requires an explicit creation start point.
- Parse
git worktree list --porcelain -z; the first record identifies the main worktree. If it is bare or stale, request a storage root or repair it before deriving paths. - Resolve the requested branch, path, and start point. Never assume the default branch name.
For a new path, default the storage root to $HOME/.worktrees; if $HOME is unset or unusable, request an explicit root. Create the root if absent, then use <root>/<main-name>-<branch-with-slashes-replaced-by-hyphens>. Stop on an existing path or normalization collision rather than inventing a suffix.
Create or Attach
- Normalize the branch with
git check-ref-format --branch "$branch"and resolve the start point to one commit withgit rev-parse --verify --end-of-options "${start_point}^{commit}". - Determine exact branch existence with
git show-ref --verifyand occupancy from porcelain records; do not substring-match. - Create or attach:
git worktree add -b "$branch" "$worktree_path" "$start_oid" # new branch
git worktree add "$worktree_path" "$branch" # existing free branch
Stop if the branch is checked out elsewhere; do not bypass occupancy with --force. Verify the exact record and git -C "$worktree_path" status --short --branch.
Remove Safely
- Confirm the exact target is a registered linked worktree, not the first/main record.
- Inventory all data:
git -C "$worktree_path" status --porcelain=v1 --untracked-files=all --ignored=matching --ignore-submodules=none
Expand directory entries when needed and inspect initialized submodules recursively. Every tracked, ??, and !! entry can be lost.
3. For detached targets, record HEAD and check reachability:
git for-each-ref --format='%(refname)' --contains="$head_oid" refs/heads refs/tags refs/remotes
Preserve an otherwise unreachable commit with a user-named branch or tag before removal.
4. Stop on a lock. Unlock only after explicit confirmation that the lock is no longer needed.
5. If loss inventory is empty and reachability is safe, run git worktree remove "$worktree_path" and verify its record disappeared.
6. If local-only data exists, display the complete loss and require approval that names it. Use --force only when Git requires it and that exact loss was approved; ignored data may disappear even without --force.
7. Preserve the branch by default. Never delete the directory directly as a substitute for git worktree remove.
Branch Deletion
Delete only when separately requested. Resolve the branch and user-chosen comparison ref to commits and prove ancestry with git merge-base --is-ancestor. Reverify the branch still points to the inspected object, then try git branch -d.
If the branch is unmerged or -d checks a different upstream/current-HEAD relationship than the chosen comparison, explain the mismatch. Use git branch -D only after separate approval to discard or bypass that exact condition and after rechecking object identity and ancestry.
Repair or Prune
Use git worktree repair for moved worktrees and verify every repaired record. A missing path is not proof that its data should be abandoned.
Prune only when the directory is genuinely gone and recovery is not wanted. Protect detached commits as above, preview with git worktree prune --dry-run --verbose, show the exact preview, then run the matching prune only after approval. Pruning metadata is not directory or branch deletion.
Установить managing-git-worktrees в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл managing-git-worktrees?
Deprecated internal reference for creating, inspecting, attaching, repairing, removing, or pruning local Git worktrees while preserving branches, commits, files, and submodule data.
Как установить скилл managing-git-worktrees?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл managing-git-worktrees запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic