git-worktree

git-worktree is a skill for Claude Code from BackToCimaCoppi/Praxis. It costs 125 tokens per session (2,104 once invoked), scanned A, original, Apache-2.0.

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 Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: positional $N argument.

Good fit 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.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/backtocimacoppi/praxis/git-worktree
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.

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.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for git-worktree

README.md
[![agentmods](https://agentmods.dev/badge/skills/backtocimacoppi/praxis/git-worktree/github.svg)](https://agentmods.dev/skills/backtocimacoppi/praxis/git-worktree)
Your own site
<a href="https://agentmods.dev/skills/backtocimacoppi/praxis/git-worktree"><img src="https://agentmods.dev/badge/skills/backtocimacoppi/praxis/git-worktree/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for git-worktree

Your own site · 80×15
<a href="https://agentmods.dev/skills/backtocimacoppi/praxis/git-worktree"><img src="https://agentmods.dev/badge/skills/backtocimacoppi/praxis/git-worktree.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
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,104 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00125 $0.02104
Opus 5.5 $0.00050 $0.00842
Sonnet 5.5 $0.00025 $0.00421
Haiku 4.5 $0.00013 $0.00210

Measured 29d ago against content hash 4f270bc1d415, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 29d 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 被调用后,第一步必须用当前运行时支持的对话内菜单询问用户选择操作;无菜单工具时用纯文本列出选项:

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

选项:

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

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


§A. 新建 worktree

输入:向用户询问英文任务名(如 coupon-center、order-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. 29d ago Changed 4f270bc1d415
  2. 1mo 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 (6 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 125 tokens to every session and 2,104 once invoked, about $0.0005 per session on Opus 5.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

changelog

Update per-package CHANGELOG.md files for a Ratel release. Drafts entries with git-cliff (scoped per package), lets you curate, then writes the CHANGELOGs. Handles both RC entries and GA-graduation collapse (merging X.Y.Z-rc. sections into a single X.Y.Z section). Invoke before tagging a release.

ratel-ai/ratel · 74 tokens

fix-issue

Fixes GitHub issues using parallel analysis agents for root cause investigation, code exploration, and regression detection. Reads issue context from gh CLI, searches codebase and memory for related patterns, generates a fix with tests, and links the resolution back to the issue via PR. Includes prevention analysis to…

yonatangross/orchestkit · 82 tokens

swarm-migrate

Cross-repo migration swarm — one coordinator + N parallel subagents (one per target repo) that apply the same transformation, open PRs, wait for CI, and report back to a shared JSON ledger. Coordinator handles topology, conflict auto-rebase, and stop-on-novel-failure. Use when bumping a shared dependency, rolling out…

yonatangross/orchestkit · 103 tokens

dev

One-command dev loop boot. Spins up portless (named HTTPS subdomain), emulate (stateful API mocks), the project's dev server, and an agent-browser session, all keyed to the current git branch. Use when starting a feature branch, switching worktrees, or returning to a project after a break. Skips silently with install…

yonatangross/orchestkit · 76 tokens

github-operations

GitHub CLI operations for issues, PRs, milestones, and Projects v2. Covers gh commands, REST API patterns, and automation scripts. Use when managing GitHub issues, PRs, milestones, or Projects with gh.

yonatangross/orchestkit · 50 tokens

release-management

Automates GitHub releases with semantic versioning, changelog generation from merged PRs, and gh CLI integration. Supports draft, prerelease, and standard release workflows with task-tracked multi-phase execution. Use when creating releases, tagging versions, or publishing changelogs.

yonatangross/orchestkit · 58 tokens