来源信息
- 仓库
- caidanw/skills
- 最近来源活动
- 2026年8月10日 23:09
- 检测到的 SKILL.md 语言
- 英语
- 星标
- 9
- 分支
- 1
安装方式
默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。
检查来源文件
决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。
文件资源管理器
2 个文件正在显示 SKILL.md
SKILL.md
来源说明 · 只读预览- name
- git-worktree
- description
- Create, remove, and list git worktrees in a standardized location
- alwaysAllow
- ["Bash"]
# Git Worktree Management
Manage git worktrees stored in `~/.git-worktrees/<repo>/<branch>`, keeping them out of the user's project directories.
## Determining Context
Before any operation, determine the repository name:
```bash
repo=$(basename "$(git rev-parse --show-toplevel)")
```
The worktree base directory is always `~/.git-worktrees/$repo/`.
## Commands
### Create (default)
If the user provides just a branch name, treat it as a create operation.
```bash
repo=$(basename "$(git rev-parse --show-toplevel)")
branch="<branch>"
dir="$HOME/.git-worktrees/$repo/$branch"
mkdir -p "$HOME/.git-worktrees/$repo"
git worktree add "$dir" "$branch"
```
If the branch doesn't exist yet, use `-b` to create it from HEAD:
```bash
git worktree add -b "$branch" "$dir" HEAD
```
After creation, **always prominently display the worktree path** so the user can open a new session pointing to it:
> Worktree created at: `~/.git-worktrees/<repo>/<branch>`
### Remove
```bash
repo=$(basename "$(git rev-parse --show-toplevel)")
git worktree remove "$HOME/.git-worktrees/$repo/<branch>"
```
If the worktree has uncommitted changes, warn the user before using `--force`.
### List
```bash
git worktree list
```
### Prune
Clean up stale worktree references (e.g., after manually deleting a worktree directory):
```bash
git worktree prune
```
## Guidelines
- Always default to **create** if the user's intent is ambiguous
- Never use `--force` without explicit user confirmation
- After creating a worktree, remind the user they can open a new Craft Agent session with that path as the working directory
- When listing, note which worktree is the main working tree vs. linked worktrees
在 GitHub 查看