帮助你使用 Git worktree 创建相互隔离的并行工作区。
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "using-git-worktrees" 技能: 1. 下载 https://raw.githubusercontent.com/microsoft/FluidFramework/main/.agency/plugins/nori/skills/using-git-worktrees/SKILL.md 2. 保存为 ~/.claude/skills/using-git-worktrees/SKILL.md 3. 装好后重载技能,告诉我可以用了
我需要在不影响当前分支工作的情况下开发一个新功能,请指导我使用 git worktree 创建独立工作区,并给出完整命令。
提供创建新 worktree、切换分支和开始开发的步骤与命令。
当前我在做大改动,但现在要紧急修复线上 Bug。请用 git worktree 方案帮我快速开一个独立目录处理 hotfix,并说明完成后如何清理。
给出 hotfix worktree 的创建、提交、合并及移除目录的操作说明。
我想同时打开主分支和一个评审分支进行对比,请说明如何用 git worktree 管理两个独立工作目录,并避免分支冲突。
说明如何为多个分支建立独立目录,并提供安全使用建议。
ls -d .worktrees 2>/dev/null.worktrees.# Check if directory pattern in .gitignore
grep -q "^\.worktrees/$" .gitignore || grep -q "^worktrees/$" .gitignore
cd $path# Node.js
if [ -f package.json ]; then npm install; fi
# Rust
if [ -f Cargo.toml ]; then cargo build; fi
# Python
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f pyproject.toml ]; then poetry install; fi
# Go
if [ -f go.mod ]; then go mod download; fi
</required>
<good-example>
cd /home/$USER/code/project/.worktrees/branch-name && npm run lint
</good-example>
# Examples - use project-appropriate command
npm test
cargo test
pytest
go test ./...
If tests fail: Report failures, ask whether to proceed or investigate.
If tests pass: Report ready.
New working directory: <full-path>
Tests passing (<N> tests, 0 failures)
All commands and tools will now refer to: <full-path>
CRITICAL: Once you create and enter a worktree, you must stay within it for the entire session.
Rules:
pwd # Should show .worktrees/branch-name in path
git branch # Should show * on your feature branch, not main
Red Flags:
| Situation | Action |
|---|---|
.worktrees/ exists | Use it (verify .gitignore) |
| `.worktree/s does not exist | Check CLAUDE.md → Ask user |
| Directory not in .gitignore | Add it immediately |
| Tests fail during baseline | Report failures + ask |
| No package.json/Cargo.toml | Skip dependency install |
Skipping .gitignore verification
Assuming directory location
Missing project installation
…
帮助你严谨评估代码评审意见,澄清疑点后再决定是否采纳与实现
帮助 AI 读取、搜索并操作本地 Git 仓库与提交记录