🌿
DevOpsJavaScript

Using Git Worktrees

by jnMetaCode

Using Git Worktrees is a DevOps skill for Claude Code, published by jnMetaCode in superpowers-zh.

7.7K stars729 forkson jnMetaCode/superpowers-zhAdded 2026/08/15Repository updated 2026/08/12
agent-skillsagentic-codingai-codingchineseclaude-codecode-reviewcursorgemini-clikiromcpnpm-packageprompt-engineeringskillssuperpowerstddtrae
Install in seconds
Install Using Git Worktrees
Copy Using Git Worktrees into your Claude Code skills folder. Run the command in your terminal, or review the source on GitHub before installing.
terminal
npx degit https://github.com/jnMetaCode/superpowers-zh/tree/main/skills/using-git-worktrees ~/.claude/skills/using-git-worktrees

Requires Node.js. Downloads this skill only — not the rest of the repository — into your Claude Code skills folder.

Without Node.js

git clone https://github.com/jnMetaCode/superpowers-zh.git

Clones the whole repository, then copy the skill’s own directory into your skills folder yourself.

In this catalog

Source file
skills/using-git-worktrees/SKILL.md in jnMetaCode/superpowers-zh
Installs to
~/.claude/skills/using-git-worktrees
Collection
One of 20 skills cataloged from this repository
Category
DevOps798 skills

What Using Git Worktrees does

Using Git Worktrees creates an isolated Git worktree for feature development so changes don't affect the current branch. It detects existing isolation, prefers native worktree tools, and falls back to manual git worktree when needed.

Using Git Worktrees is cataloged under DevOps on DirSkills. Using Git Worktrees comes from a repository tagged agent-skills, agentic-coding, ai-coding, chinese and claude-code.

Documentation

README

使用 Git 工作树

概述

确保工作发生在隔离的工作区中。优先使用你的平台的原生 worktree 工具。仅在没有原生工具可用时,再回退到手动 git worktree。

核心原则: 先检测现有隔离。然后用原生工具。再回退到 git。绝不与 harness 对抗。

开始时宣布: "我正在使用 using-git-worktrees 技能来建立一个隔离的工作区。"

步骤 0:检测现有隔离

创建任何东西之前,先检查你是否已经在一个隔离的工作区里。

GIT_DIR=$(cd "$(git rev-parse --git-dir)" 2>/dev/null && pwd -P)
GIT_COMMON=$(cd "$(git rev-parse --git-common-dir)" 2>/dev/null && pwd -P)
BRANCH=$(git branch --show-current)

Submodule 守卫: 在 git submodule 内 GIT_DIR != GIT_COMMON 也为真。在判定"已经在 worktree 内"之前,先确认你不在 submodule 里:

# 如果这条命令返回路径,说明你在 submodule 里,不是 worktree —— 按普通仓库处理
git rev-parse --show-superproject-working-tree 2>/dev/null

如果 GIT_DIR != GIT_COMMON(且不是 submodule): 你已经在一个 linked worktree 内。跳到步骤 2(项目设置)。不要再创建一个 worktree。

按分支状态报告:

This is the opening of the README. Read the full README on GitHub.

Commands Using Git Worktrees provides

Slash commands named in this skill’s SKILL.md, listed in the order they first appear.

  • /worktree

Frequently asked about Using Git Worktrees

  • What else does jnMetaCode publish alongside Using Git Worktrees?

    Using Git Worktrees is one of 20 skills that DirSkills catalogs from jnMetaCode/superpowers-zh, the repository it ships in. Its siblings there include Brainstorming, Chinese Code Review and Chinese Commit Conventions. Each one is a separate skill with its own page in this directory, installs the same way Using Git Worktrees does, and is maintained by jnMetaCode in that same repository. The rest of the collection is listed on the jnMetaCode/superpowers-zh page.

  • How does Using Git Worktrees compare to other DevOps skills?

    Using Git Worktrees ranks #124 by stars among the 798 DevOps skills in this catalog. The most-starred ones next to it are Backend Patterns, API Connector Builder and Migration. DirSkills ranks by the star count of the repository each skill ships in, so that order reflects how popular those repositories are rather than any review of Using Git Worktrees against them. Open each page to compare what they document and how they install.

More from jnMetaCode/superpowers-zh

Using Git Worktrees is one of 20 skills cataloged on DirSkills from jnMetaCode/superpowers-zh.

See all 20 skills
💡
2w ago

Brainstorming

Brainstorming turns ideas into design specifications through collaborative questioning before any implementation work. Use it before creating features, building components, adding functionality, or modifying behavior to explore user intent, requirements, and design.
AI Engineering
7.7K729
💬
2w ago

Chinese Code Review

Chinese Code Review provides communication templates and priority labels (must-fix/suggest/for-reference) for giving code review feedback in Chinese teams, avoiding over-politeness or bluntness. Use when explicitly invoked via /chinese-code-review to conduct or guide a code review.
Quality
7.7K729
📝
2w ago

Chinese Commit Conventions

Chinese Commit Conventions adapts Conventional Commits for Chinese teams with type tables, commit message templates, breaking change rules, issue linking, and changelog generation configs. Use it to set up commitlint, husky, and commitizen for Chinese-language commit workflows.
Quality
7.7K729
📝
2w ago

Chinese Documentation

Chinese Documentation provides a style guide for Chinese technical documentation, covering spacing, punctuation, terminology, and bilingual API doc formats. Use it when a user explicitly invokes /chinese-documentation to improve the readability and consistency of Chinese technical writing.
Writing
7.7K729
🔧
2w ago

Chinese Git Workflow

Chinese Git Workflow documents configuration differences for Gitee, Coding.net, Jihu GitLab, and CNB, covering SSH/HTTPS credentials, remote mirror sync, and CI/CD integration. Use it when setting up or standardizing Git workflows for teams in China.
DevOps
7.7K729
🤖
2w ago

Dispatching Parallel Agents

Dispatching Parallel Agents delegates independent debugging tasks to parallel subagents with isolated contexts, so each can work on a separate problem without interference. Use it when multiple unrelated test failures or subsystem issues can be investigated concurrently.
AI Engineering
7.7K729