ce-worktree
하는 일
새 브랜치나 기존 브랜치에 격리된 작업 공간을 만들어, 메인 폴더는 그대로 둡니다. 한 저장소에서 여러 작업을 함께 하는 개발자를 위한 스킬입니다.
사용하는 경우
- ✓새 작업을 시작하면서 메인 체크아웃과 분리하고 싶을 때.
- ✓pull request나 커밋을 자체 폴더에서 체크아웃하고 싶을 때.
- ✓브랜치가 이미 다른 곳에서 체크아웃되어 있는 경우. 두 번째 복사본을 만드는 대신 그 위치를 알려 줍니다.
스킬 링크
https://github.com/EveryInc/compound-engineering-plugin/blob/main/skills/ce-worktree/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“이 기능을 위해 별도의 작업 공간을 설정해 주세요. 제 메인 폴더는 건드리지 말아 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 먼저 작업이 이미 격리되어 있는지 확인한 뒤, 내장 worktree 도구나 일반 git을 사용해 새 작업 공간을 만들고, 그 경로와 브랜치를 알려 줍니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Worktree Isolation
Ensure the current work happens in an isolated workspace, without disturbing the user's main checkout. Most coding harnesses now create a worktree by default at session start, so the common case is that isolation already exists.
Done when: the caller is working in an isolated tree — existing or newly created — and its path and branch have been reported, or a blocker has been reported instead.
Order of operations: detect existing isolation -> prefer a native worktree tool -> fall back to plain git. Never create a worktree the harness cannot see.
Two modes, set by the caller's need:
- New work (default). No ref named — create a fresh branch from a base (trunk). This is what
ce-workandce-code-reviewuse when the user picks the worktree option. - Isolate an existing ref. The caller names a PR head, branch, or commit — attach the worktree to that ref instead of creating a new branch. A branch can be checked out in only one worktree at a time. If the named ref is already checked out anywhere (most commonly as the primary checkout's current branch), do not create a second worktree — report that it is already checked out at
<path>and let the caller act (work there in place; or, only if a clean separate tree is essential, create a detached worktree at the same commit).
Step 0: Detect existing isolation
Compare the resolved absolute git dir against the resolved absolute common git dir. Git mixes absolute and relative forms depending on the current directory (from a subdirectory of a normal checkout, --git-dir comes back absolute while --git-common-dir may be relative), so a raw string compare yields a false "already isolated":
git rev-parse --absolute-git-dir # absolute git dir for this worktree
(cd "$(git rev-parse --git-common-dir)" && pwd -P) # absolute shared (common) git dir
Equal -> normal checkout; continue to Step 1.
Different -> a linked worktree or a submodule. Distinguish with git rev-parse --show-superproject-working-tree:
- Non-empty -> submodule; treat it as a normal checkout and continue to Step 1.
- Empty -> already isolated. Report the worktree path (
git rev-parse --show-toplevel) and current branch, then work in place — a worktree-from-worktree lands in the wrong tree and is invisible to the harness that made the current one. In isolate-an-existing-ref mode, check that ref out here (unless it is already current) rather than nesting a worktree.
Step 1: Prefer the harness's native worktree tool
If the harness provides a native worktree primitive — for example an EnterWorktree / WorktreeCreate tool, a /worktree command, or a --worktree flag — use it and stop. Native tools place, track, and clean up the worktree so the harness can manage it. A behind-the-back git worktree add creates phantom state the harness cannot see, navigate to, or clean up.
Step 2: Git fallback
Only when there is no native tool and Step 0 found no existing isolation.
- Run from the repo root:
cd "$(git rev-parse --show-toplevel)". The paths below are repo-root-relative, but the skill runs from the user's current directory — without this,.worktrees/<branch>and the.gitignoreedit land in a subdirectory (e.g.src/.worktrees/...). - Choose a meaningful branch name from the work description (e.g.
feat/login,fix/email-validation) — never an opaque auto-generated one. Base: origin's default branch, elsemain. - Ensure
.worktrees/is gitignored before creating anything:git check-ignore -q .worktrees/— with the trailing slash, so an existing directory-only.worktrees/rule is honored even before the directory exists (without the slash the probe misses it and dirties a correctly-configured repo). Not ignored -> add a.worktrees/line to.gitignore. - Refresh the base with
git fetch origin <from-branch>. This is non-fatal — nooriginremote, a differently-named remote, or a local-only branch is not an abort; continue with the local ref. - Create the worktree, per mode:
- New work:
git worktree add -b <branch-name> .worktrees/<branch-name> origin/<from-branch>(use the local<from-branch>ref iforigin/<from-branch>does not exist). - Existing branch or tag:
git worktree add .worktrees/<slug> <target-ref>. - PR: check it out on a local branch —
git fetch origin pull/<n>/head:pr-<n>then `
- New work:
자주 묻는 질문
메인 체크아웃이 바뀌나요?
아닙니다. 메인 체크아웃을 건드리지 않도록 설계되었습니다.
기존 pull request 브랜치에 붙일 수 있나요?
네. 기존 브랜치, pull request, 또는 커밋에 워크트리를 연결할 수 있습니다.
브랜치가 이미 사용 중이면 어떻게 하나요?
그 브랜치가 어디에 체크아웃되어 있는지 알려 주며, 다음에 무엇을 할지는 사용자가 정합니다.
상세 정보
작성자의 원본 설명
Set up isolated git worktrees — create a new branch for fresh work, or attach a worktree to an existing branch, PR, or commit. Use when starting isolated work or isolating an existing ref.
인기도
- GitHub 스타
- 26k
- 순위
- #10052
- 라이선스
- MIT
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
ce-babysit-pr
26k에이전트가 리뷰 댓글, 실패한 검사, 오래된 브랜치를 시간에 걸쳐 처리하며 열린 GitHub 풀 리퀘스트가 병합 상태로 나아가도록 돕습니다.
ce-bakeoff
26k에이전트가 한 문제에 대해 여러 경쟁 해결책을 만들고 비교한 뒤, 가장 강한 부분을 합쳐 하나의 추천 방식으로 정리하도록 돕습니다.
ce-brainstorm
26k에이전트가 막연한 아이디어를 짧은 안내 대화를 거쳐, 작업을 시작하기 전에 명확하고 알맞은 크기의 요구 사항으로 바꾸도록 돕습니다.
ce-code-review
26k에이전트가 지정된 코드 변경이나 풀 리퀘스트를 버그, 회귀, 누락된 테스트, 표준 문제 측면에서 검토하고, 명확한 발견 사항을 보고하도록 돕습니다.