Token导航 LogoToken导航TokenDH.com
待分类需要联网github未标认证来源可访问许可证需确认审计通过

worktree工作树

Agent Skill

worktree 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

267

周安装

11

GitHub Stars

公开资料未说明

下载量

87
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:worktree(工作树)
来源仓库:https://github.com/scando1993/sugar
仓库路径:skills/worktree
安装命令:
npx skills add https://github.com/scando1993/sugar --skill worktree
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/scando1993/sugar --skill worktree

简介

worktree 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息。

  • 适合围绕仓库状态、代码变更或协作事项进行整理。
  • 通过 npx skills add 命令从指定 GitHub 仓库安装使用。
  • 建议确认权限范围和维护状态,避免触发联网或文件读写操作。
  • worktree 属于待分类类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Git Worktree Management

Iron Law

NEVER MODIFY FILES IN A WORKTREE YOU DID NOT CREATE

Operations

1. Create

Create a new worktree for isolated parallel development.

git worktree add <path> -b <branch-name>
  • Always use a descriptive branch name matching the worktree purpose
  • Place worktrees in a consistent location (e.g., /tmp/<repo>-worktrees/<name>)
  • Verify the worktree was created successfully before proceeding
  • Initialize any required workspace files (progress.txt, CLAUDE.md, prd.json)

2. List

Show all active worktrees and their branches.

git worktree list
  • Check for stale or orphaned worktrees
  • Verify each worktree points to a valid path
  • Note which branches are checked out where

3. Switch

Navigate between worktrees safely.

  • Always verify your current working directory before making changes
  • Use absolute paths to avoid confusion
  • Check git status in the target worktree before starting work
  • Never assume you are in the correct worktree — verify with pwd and git branch

4. Sync

Keep worktrees up to date with upstream changes.

# From within the worktree:
git fetch origin
git rebase origin/main  # or merge, depending on strategy
  • Resolve conflicts in the worktree where they occur
  • Do not sync during active implementation — finish the current story first
  • After syncing, re-run quality checks to catch integration issues

5. Cleanup

Remove worktrees that are no longer needed.

git worktree remove <path>
git worktree prune
  • Verify all changes are committed and pushed before removing
  • Never force-remove a worktree with uncommitted changes
  • Prune stale references after removal
  • Delete the associated branch only after confirming the merge

Red Flags — If You Catch Yourself Thinking:

ThoughtReality
"I'll just edit files in this other worktree quickly"Each worktree is an isolated workspace. Switch properly or create a new one.
"I don't need to check which worktree I'm in"Wrong worktree = wrong branch = wrong commits. ALWAYS verify with pwd and git branch.
"I'll force-remove this worktree to save time"Force-remove destroys uncommitted work. Check git status first.
"Pruning is optional, I'll do it later"Stale worktree references cause confusing errors. Prune after every removal.

Rules

  • Always verify your working directory before making any changes
  • Never force-remove a worktree without checking for uncommitted changes
  • Prune stale worktree references after every removal
  • Use absolute paths for all worktree operations
  • One branch per worktree — never checkout a branch that is active in another worktree

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

37.66%
按下载量换算33

Claude

28.49%
按下载量换算25

Cursor

17.61%
按下载量换算15

Gemini CLI

8.57%
按下载量换算7

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills