Token导航 LogoToken导航TokenDH.com
前端设计需要联网unknown未标认证来源可访问许可证需确认审计未展示

git-worktreeGit 工作树

Agent Skill

git-worktree 用于补充前端设计相关能力,适合在 Local Agent 中需要让 Agent 承接前端设计相关任务时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

364

周安装

15

下载量

119
Local Agent

安装说明

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

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

复制命令到本机终端执行。当前暂无明确安装命令,请以来源页面说明为准。

简介

git-worktree 用于补充前端设计相关能力。

  • 适合在 Local Agent 中承接前端设计相关任务。
  • 可结合来源仓库和原始 README 核验具体用法。git-worktree 属于前端设计类 Skill,可作为该场景下的辅助能力补充。
  • 安装前建议确认权限范围和维护状态,避免触发联网或文件操作。
  • 注意是否会执行命令或访问外部资源,确保操作安全可控。

SKILL.md

Git Worktree Management

Overview

This skill provides comprehensive Git worktree management capabilities, enabling work on multiple branches simultaneously in isolated directories. Worktrees eliminate the need for stashing when switching contexts and are ideal for parallel development, quick bug fixes, and code reviews.

When to Use This Skill

Use this skill when the user wants to:

  • Create a new worktree from a local branch, remote branch, or new branch
  • List all active worktrees with detailed information
  • Delete and clean up worktrees
  • Get navigation commands to switch between worktrees
  • Set up parallel development environments

How It Works

Configuration

Location Strategy: Sibling directory pattern

  • Worktrees are created outside the main repository: ../<project>-<branch>
  • Example: Main repo at ~/dev/myproject, worktree at ~/dev/myproject-feature-x
  • Benefits: Clean separation, no nested repos, IDE-friendly

Naming Convention: <project>-<branch>

  • Project name extracted using: basename "$(git rev-parse --show-toplevel)"
  • Example: myproject-feature-auth, myapp-bugfix-login

Interface

Hybrid Mode: Accepts arguments when provided, prompts when missing

Usage patterns:

# Interactive menu
User: "Manage my worktrees"
User: "Create a worktree"

# Direct with arguments
User: "Create worktree from remote branch feature-x"
User: "List all worktrees"
User: "Delete worktree for branch hotfix-123"

Core Operations

1. List Worktrees

Purpose: Show all active worktrees with detailed information

What to display:

  • Index number for easy reference
  • Worktree path
  • Branch name
  • HEAD commit hash (short)
  • Commit message (first line)
  • Indicator for current worktree

Implementation:

# Get project name
project=$(basename "$(git rev-parse --show-toplevel)")

# List worktrees with details
git worktree list -v

Output format:

Git Worktrees for myproject:

1. /Users/dev/myproject (main)
   abc1234 Initial commit
   [CURRENT]

2. /Users/dev/myproject-feature-x (feature-x)
   def5678 Add authentication logic

3. /Users/dev/myproject-hotfix (hotfix-123)
   789abcd Fix login bug

2. Create Worktree from Remote Branch

Purpose: Fetch and create a worktree from a remote branch

Steps:

  1. Validate we're in a git repository
  2. Get project name: project=$(basename "$(git rev-parse --show-toplevel)")
  3. Extract branch name from remote reference (e.g., origin/feature-xfeature-x)
  4. Check if worktree already exists (warn and skip if it does)
  5. Fetch remote branch: git fetch origin <branch-name>
  6. Verify remote branch exists (check exit code)
  7. Determine worktree path: ../<project>-<branch-name>
  8. Create worktree: git worktree add../<project>-<branch-name> origin/<branch-name>
  9. Show success message with path and navigation command

Error handling:

  • Not in git repo: Show clear error message
  • Worktree already exists: "Worktree for branch 'X' already exists at Y. Use 'list' to see all worktrees."
  • Remote branch doesn't exist: "Remote branch 'origin/X' not found. Available branches: [list]"

Success output:

✓ Created worktree for remote branch 'feature-x'

Location: /Users/dev/myproject-feature-x
Branch: feature-x (tracking origin/feature-x)

To switch to this worktree:
  cd ../myproject-feature-x

To start working:
  cd ../myproject-feature-x && code .

3. Create Worktree from Local Branch

Purpose: Create a worktree from an existing local branch

Steps:

  1. Validate we're in a git repository
  2. Get project name
  3. Verify local branch exists: git rev-parse --verify <branch-name>
  4. Check if worktree already exists
  5. Create worktree: git worktree add../<project>-<branch-name> <branch-name>
  6. Show success message with navigation

Error handling:

  • Local branch doesn't exist: "Local branch 'X' not found. Available branches: [list local branches]"
  • Worktree already exists: Same as remote case

4. Create Worktree with New Branch

Purpose: Create a worktree with a brand new branch

Parameters needed:

  • New branch name
  • Base branch (optional, default: current branch)

Steps:

  1. Validate we're in a git repository
  2. Get project name
  3. Get base branch (use current if not specified)
  4. Check if worktree directory already exists
  5. Create worktree with new branch: git worktree add -b <new-branch>../<project>-<new-branch> <base-branch>
  6. Show success message

Success output:

✓ Created new worktree with branch 'experiment-auth'

Location: /Users/dev/myproject-experiment-auth
Branch: experiment-auth (based on main)

To switch to this worktree:
  cd ../myproject-experiment-auth

5. Delete Worktree

Purpose: Remove a worktree and show prune command

Steps:

  1. If no branch specified, list all worktrees for selection
  2. Verify worktree exists for specified branch
  3. Remove worktree: git worktree remove <path> or manually rm -rf <path>
  4. Show manual prune command (don't auto-execute per user preference)

Output:

✓ Removed worktree at /Users/dev/myproject-feature-x

To clean up metadata, run:
  git worktree prune

6. Prune Worktrees

Purpose: Clean up worktree metadata

Steps:

  1. Run: git worktree prune
  2. Show what was cleaned

Output:

✓ Pruned stale worktree metadata

Run 'git worktree list' to see remaining worktrees.

7. Switch Helper

Purpose: Show easy navigation to worktrees

Implementation:

  1. List all worktrees (numbered)
  2. Provide copy-ready cd commands

Output:

Available worktrees:

1. main (current)
   cd /Users/dev/myproject

2. feature-x
   cd /Users/dev/myproject-feature-x

3. hotfix-123
   cd /Users/dev/myproject-hotfix

Interactive Flow

When invoked without arguments:

  1. Show menu: Git Worktree Management 1. List all worktrees 2. Create from remote branch 3. Create from local branch 4. Create new branch 5. Delete worktree 6. Prune metadata 7. Switch between worktrees
  2. Prompt for selection
  3. For create operations, prompt for required info (branch name, base branch, etc.)
  4. Execute operation
  5. Show results with clear next steps

Direct Command Parsing

When arguments are provided, parse intent:

  • "list" → List operation
  • "create remote " → Create from remote
  • "create local " → Create from local
  • "create new [from]" → Create new branch
  • "delete " → Delete worktree
  • "prune" → Prune metadata
  • "switch" → Switch helper

Error Handling Checklist

Before any operation:

  • ✓ Verify in git repository: git rev-parse --git-dir
  • ✓ Get project name successfully
  • ✓ Validate branch exists (for remote/local operations)
  • ✓ Check worktree doesn't already exist (for create operations)
  • ✓ Provide actionable error messages with suggestions

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

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

平台分布

Local Agent

78.23%
按下载量换算93

安全审计

暂无安全审计结果可展示。

权限和风险

需要联网

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

安装前确认

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

来源信息

继续浏览同类 Skills