git-worktree

A tool for managing Git worktrees, which are separate working folders linked to one Git repository. It supports working on branches in parallel and bringing their changes back to the main branch.

In plain words
What is it for?
Use it to create a worktree, merge its branch into the main branch, sync the main branch to other worktrees, or clean up the current worktree.
Why use it?
It provides a consistent way to create, synchronize, merge, and clean up parallel development folders. This removes much of the manual Git work involved in switching between branches and directories.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/backtocimacoppi/praxis/git-worktree
Any agent
npx skills add BackToCimaCoppi/Praxis --skill git-worktree
Clone the repo
git clone --depth 1 https://github.com/BackToCimaCoppi/Praxis

Made for: Claude Code, Codex.

Per session 125 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,089 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00125 $0.02089
Opus 5 $0.00063 $0.01045
Sonnet 5 $0.00025 $0.00418
Haiku 4.5 $0.00013 $0.00209

Measured 2d ago against content hash 2bb7b9694fd3, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

git-worktree scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/git-worktree/SKILL.md · 203 lines

How it starts

The opening of the file, as written. The whole thing — 203 lines — stays where its author put it; the contents beside it link to each section on GitHub.

git-worktree

多 worktree 并行开发管理工具。主仓库当前 checkout 的分支即主干分支,是唯一主干,所有 worktree 的改动最终合并回主干。worktree 与任何总控/任务体系解绑——同一 worktree 可承载多个任务,若项目启用了 control skill,通过 /control switch 切换。

约定探测(所有操作的公共前置)

# 主仓库路径 = git worktree list 的第一行(git 保证主仓库永远排第一)
MAIN_ROOT=$(git worktree list | head -1 | awk '{print $1}')
# 主干分支 = 主仓库当前 checkout 的分支
TRUNK_BRANCH=$(git -C "$MAIN_ROOT" branch --show-current)
# worktree 目录命名前缀 = 主仓库目录名
REPO_NAME=$(basename "$MAIN_ROOT")
PARENT_DIR=$(dirname "$MAIN_ROOT")

# 布局探测:主仓库目录名 == 主干分支名(容器目录布局,如 ~/projects/myrepo/main)→ worktree 不带前缀
if [ "$REPO_NAME" = "$TRUNK_BRANCH" ]; then
    WT_PREFIX=""              # 容器布局:worktree 目录 = PARENT_DIR/{名称}
else
    WT_PREFIX="$REPO_NAME-"   # 传统布局:worktree 目录 = PARENT_DIR/{REPO_NAME}-{名称}
fi

TRUNK_BRANCH 探测为空(主仓库处于 detached HEAD),停下询问用户主干分支名,不猜测。

合并原则(所有涉及合并的操作均遵守)

  1. 先提交源分支的未提交改动
  2. 再提交目标分支的未提交改动
  3. 执行 merge
  4. 遇到冲突直接解决,不 stash、不建中间分支

触发入口(强制)

skill 被调用后,第一步必须AskUserQuestion 询问用户选择操作:

问题:你想执行哪个 worktree 操作?

选项:

  • 新建 worktree:从主干拉出新分支,在兄弟目录创建 worktree
  • 合并到主干:把当前 worktree commit 并 merge 到主干(完工时用)
  • 主干同步到所有 worktree:把主干 merge 进每个 feature worktree(重大改动时用)
  • 清理当前 worktree:验证已全部合并到主干后删除 worktree 和分支

根据用户选择跳到对应 §。


§A. 新建 worktree

输入:向用户询问英文任务名(如 coupon-centerorder-export

命名规则

  • 目录名:{WT_PREFIX}{名称}(传统布局为 {REPO_NAME}-{名称},容器布局直接 {名称},探测逻辑见「约定探测」)
  • 路径:主仓库的兄弟目录PARENT_DIR/{WT_PREFIX}{名称}
  • 分支:feature/{名称},从最新主干拉出
  • 禁止放在主仓库任何子目录内(会污染 git status)

执行命令

# 先跑「约定探测」得到 MAIN_ROOT / TRUNK_BRANCH / REPO_NAME / PARENT_DIR / WT_PREFIX
NAME="<用户提供>"

# 更新主干
git -C "$MAIN_ROOT" fetch origin "$TRUNK_BRANCH"

# 创建 worktree
git -C "$MAIN_ROOT" worktree add "$PARENT_DIR/$WT_PREFIX$NAME" -b "feature/$NAME" "$TRUNK_BRANCH"

# 验证
git -C "$MAIN_ROOT" worktree list

完成后:告知用户新 worktree 的完整路径和分支名。


§B. 合并当前 worktree 到主干

适用场景:当前 worktree 完工,把改动 merge 到主干。不同步到其他 worktree(如需同步,之后再执行 §C)。

Read the full file on GitHub · 203 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 203 lines · 125 tokens per session scan A 2bb7b9694fd3

Subscribe to this mod's changes

git-worktree is a skill published in the GitHub repository BackToCimaCoppi/Praxis (7 stars, last pushed 8d ago), licensed Apache-2.0. It adds 125 tokens to every session and 2,089 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

triz-synergy

Разрешает противоречия в разработке: формулирует пару взаимоисключающих требований к одному объекту, ищет уже существующий ресурс в коде и в структуре данных, разделяет по структуре/времени/условию/отношению и проверяет решение различающим опытом. On-demand only — вызывать явно, когда виден признак противоречия. Use…

stepanenkoviktor0110-boop/ai-dev-methodology · 175 tokens

code-writing

Universal quality coding process: plan, TDD, reviews. Use whenever code needs to be written — ad-hoc or as part of a task. Use when: "напиши код", "закодь", "реализуй", "write code", "implement" For planning tasks → tech-spec-planning skill. For specs → user-spec-planning skill.

stepanenkoviktor0110-boop/ai-dev-methodology · 77 tokens

feature-execution

Orchestrate feature delivery as team lead: spawn agents by wave, manage review cycles (max 3 rounds), commit per wave. Use when: "выполни фичу", "do feature", "execute feature", "запусти фичу", "выполни все задачи", "execute all tasks".

stepanenkoviktor0110-boop/ai-dev-methodology · 73 tokens

methodology

AI-First development methodology: spec-driven pipeline, project structure, skills/agents ecosystem, quality gates. Use when: "изучи методологию", "изучи глобальную папку", "как работает методология", "what is the pipeline", "покажи пайплайн", "расскажи о процессе разработки", "how does the methodology work", "explain…

stepanenkoviktor0110-boop/ai-dev-methodology · 97 tokens

task-decomposition

Decompose approved tech-spec into atomic task files with parallel creation and validation. Use when: "разбей на задачи", "декомпозиция", "decompose tech-spec", "создай задачи из техспека", "/decompose-tech-spec".

stepanenkoviktor0110-boop/ai-dev-methodology · 55 tokens

tech-spec-planning

Creates tech-spec.md with architecture, decisions, testing strategy, and implementation plan. Use when: "сделай техспек", "составь техспек", "техническая спецификация", "tech spec", "создай тз", "составь тз", "new-tech-spec", "/new-tech-spec" Requires existing user-spec.md as input (create with user-spec-planning…

stepanenkoviktor0110-boop/ai-dev-methodology · 93 tokens