worktree-guide
它能做什么
这份指南教你如何在一个 git 项目中使用 worktree、终端面板和 Lazygit 同时处理多项任务。适合想要实用、分步设置方法的人。
适用场景
- ✓当你想在不切换分支的情况下并行设置多项任务时。
- ✓当你刚接触 git worktree,想要有人引导的教程时。
- ✓当你想要一份用 Lazygit 同时关注多个 worktree 的参考资料的时候。
技能链接
https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/development/worktree-guide/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请一步步带我设置并行 worktree,让我能同时开发两个功能。”
每周 5 个新技能,1 分钟读完。
工作原理
这份指南首先检查你的文件夹是否为 git 项目,然后说明包含终端面板的布局,并帮助你一步步创建和管理 worktree。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Guide the user through parallel development workflows using Ghostty terminal panels, git worktrees, and Lazygit. This is both a teaching experience and a practical reference.
Preflight
Before starting, detect the user's environment:
git rev-parse --is-inside-work-tree 2>&1 && echo "GIT_OK" || echo "NOT_GIT"
If not a git repo:
This isn't a git repository. Navigate to a git project first, then come back to
/worktree-guide.
Check if we're in a worktree or main repo:
git worktree list
pwd
Note the context for later guidance.
Phase 1: Welcome & Context Detection
Display based on environment:
If in main repo:
## Worktree Parallel Development Guide
Welcome! I'll guide you through setting up and using parallel worktrees for multi-task development.
┌─────────────────────────────────────────────────────────────┐
│ Ghostty Terminal │
│ ┌──────────────────────┬──────────────────────┐ │
│ │ │ │ │
│ │ Claude (Task 1) │ Claude (Task 2) │ │
│ │ claude/login-page │ claude/fix-auth-bug │ │
│ │ │ │ │
│ ├──────────────────────┴──────────────────────┤ │
│ │ Lazygit (monitoring) │ │
│ └─────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
**Your workflow:**
1. Create worktrees → `/worktree-init`
2. Open Ghostty panels → `Cmd+D` / `Cmd+Shift+D`
3. Run Claude in each panel → `cd <worktree> && claude`
4. Deliver when done → `/worktree-deliver`
5. Clean up → `/worktree-cleanup`
What would you like to do?
Use AskUserQuestion:
- "Learn the full workflow" — Start from Phase 2
- "Just show keybindings" — Jump to Quick Reference
- "Create worktrees now" — Suggest
/worktree-init - "Something else" — Ask what they need
If already in a worktree:
## Worktree Status
You're already inside a worktree! Let me check your status.
Then run the equivalent of /worktree-check and provide contextual guidance.
Phase 2: Ghostty Essentials
EXPLAIN:
## Ghostty Panel Management
Ghostty's panel system is perfect for parallel development. Here are the essential keybindings:
SHOW:
┌─────────────────────────────────────────────────────────────┐
│ GHOSTTY KEYBINDINGS │
├─────────────────────────────────────────────────────────────┤
│ │
│ SPLITTING │
│ ───────── │
│ Cmd+D Split panel to the right │
│ Cmd+Shift+D Split panel below │
│ │
│ NAVIGATION │
│ ───────── │
│ Cmd+Alt+←/→/↑/↓ Move focus between panels │
│ Cmd+[/] Cycle through panels │
│ │
│ SIZING │
│ ───────── │
│ Cmd+Shift+E Equalize all panel sizes │
│ Cmd+Shift+F Toggle zoom (fullscreen current panel) │
│ │
│ CLOSING │
│ ───────── │
│ Cmd+W Close current panel │
│ │
└─────────────────────────────────────────────────────────────┘
**Pro tip:** Use Cmd+Shift+F to zoom into a panel when you need focus, then press it again to return to the multi-panel view.
PAUSE - "Ready to learn about Lazygit? (Or skip to workflow)"
Phase 3: Lazygit Essentials
EXPLAIN:
## Lazygit for Monitoring Worktrees
Lazygit gives you a visual overview of all your worktrees and their changes. Run it from your main repo to monitor everything.
SHOW:
┌─────────────────────────────────────────────────────────────┐
│ LAZYGIT KEYBINDINGS │
常见问题
我需要 Ghostty 才能使用吗?
这份指南围绕 Ghostty 和 Lazygit 编写,因此它推荐用这些工具进行设置。
如果我不在 git 项目中怎么办?
指南会告诉你先打开一个 git 项目,然后再重新运行。
它只是一套说明吗?
不是。它是交互式的,因此你的智能体可以检查你的环境,并引导你完成每一步。
详情
作者的原始描述
Interactive guide for parallel development with Ghostty, git worktrees, and Lazygit. Use when setting up multi-task workflows or learning the worktree system.
热度
- GitHub 星标
- 33k
- 排名
- #8814
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
owasp-security
33k教你的智能体掌握面向网页应用、API、移动端、容器和 AI 智能体的 OWASP 安全指南,以便发现常见弱点并提出修复建议。
agent-management
33k让你的智能体使用 AI Maestro 命令行工具创建、列出、休眠、唤醒、重命名和删除 AI 智能体,管理每个智能体的生命周期。
agent-messaging
33k让你的智能体使用智能体消息协议,在 AI 智能体之间发送、接收和回复带签名的消息,大部分在你自己的电脑上完成。
docs-search
33k让你的智能体搜索自动生成的代码文档,查找函数签名、类定义和注释,从而在修改代码之前核对真实的 API。