# Using Git Worktrees

> 用于需要隔离开发环境的工程任务：当用户要并行做多个需求、明确说“单独开分支做”“不要污染当前工作区”“给这个任务单独开一套目录”，或任务会持续较久并改动多个文件时使用。Prefer `planning-with-files` when 任务还没拆清；Combine with `git-commit` / `github-pr-creation` / `verification-before-completion` when 需要形成完整工程闭环；Do not use for 小改动、纯研究或只改文案的任务。

- Skill: `hebertzhu/using-git-worktrees` (Agent Skill)
- Install (CLI): `npx skillmds@latest add hebertzhu/using-git-worktrees`
- Raw SKILL.md: https://api.skillmd.com/api/skills/hebertzhu/using-git-worktrees/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: hebertzhu (https://skillmd.com/u/hebertzhu)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/hebertzhu/using-git-worktrees

---


# using-git-worktrees

## Intent
- 用于需要隔离开发环境的工程任务：当用户要并行做多个需求、明确说“单独开分支做”“不要污染当前工作区”“给这个任务单独开一套目录”，或任务会持续较久并改动多个文件时使用。Prefer `planning-with-files` when 任务还没拆清；Combine with `git-commit` / `github-pr-creation` / `verification-before-completion` when 需要形成完整工程闭环；Do not use for 小改动、纯研究或只改文案的任务。

## Default operating pattern
1. Capture the actual engineering goal and the next decision that matters.
2. Inspect the current code, tests, branch state, or CI context before acting.
3. Take the smallest next action that reduces uncertainty or advances delivery.
4. Collect fresh evidence before claiming progress.
5. Summarize status, risks, and the next recommended step.

## Pack fit
- Included in: `engineering-workflow`
- Keep examples generic, privacy-safe, and portable across hosts.

## Boundary
- Do not use for tiny single-file edits that do not justify extra setup.

