worktree
하는 일
이 스킬은 고립된 git worktree를 설정합니다. worktree는 자체 브랜치에서 프로젝트를 추가로 체크아웃한 것이며, Vibe 폴더에 저장됩니다. 하나의 저장소에서 여러 작업을 하는 개발자를 위한 것입니다.
사용하는 경우
- ✓git 프로젝트의 별도 복사본에서 작업하고 싶을 때.
- ✓작업을 위해 자체 worktree에 새 브랜치를 시작하고 싶을 때.
- ✓더 이상 필요 없는 worktree를 나열하거나 지우고 싶은 경우.
스킬 링크
https://github.com/mistralai/mistral-vibe/blob/main/vibe/plugins/builtins/vibe/skills/worktree/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“로그인 버그 수정을 위해 별도의 git worktree를 설정해 주세요. 제 메인 작업은 건드리지 않도록 해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
스킬은 worktree를 위한 이름 있는 폴더를 만들고, 시작 지점을 기록합니다. 각 worktree의 기록을 남겨 나중에 찾아서 지울 수 있게 합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Worktree Management
Git worktrees live under $VIBE_HOME/worktrees/ (default ~/.vibe/worktrees/),
each in a per-repository bucket named <repo_root.name>-<sha256(common_git_dir)[:12]>
so worktrees from different repos never collide.
$VIBE_HOME/worktrees/
.claims/<bucket>/<name>/ # claim records and holder markers
record.json # metadata: branch, base_commit, branch_created, claimed_at
recovery.json # snapshot metadata for a retained chat
holders/ # one empty file per live session
<bucket>/<name>/ # the actual git worktree checkout
Creating a worktree
- Compute the bucket from the repo root and common git dir.
- Validate the name (single portable path segment; no
<>:"/\|?*, no trailing space or dot, no Windows reserved names likeCON/PRN/NUL/COM1-COM9/LPT1-LPT9, not.or..). - Reserve the directory with
mkdir(atomic claim — fails if taken). - For a new branch, start from the remote's default branch (fetch first, best-effort). For an existing branch, check it out into the worktree.
git worktree add -b <name> <path> <start_point>(or without-bfor reuse).- Record the worktree's own HEAD as
base_commit— this is the baseline for cleanup, not the invoking checkout's HEAD. - Write
record.jsonunder.claims/<bucket>/<name>/.
When no name is given, derive one by slugifying the prompt: NFKD-normalize,
lowercase, replace non-[a-z0-9]+ with -, take the first 6 words, trim to
40 chars, drop trailing stop words. Branch gets a vibe/ prefix. Append
-2, -3, etc. on collision (up to 100). Fall back to a random slug if empty.
Reuse an existing worktree only after validating: no symlinks in the path,
.git is a file (not a directory), same common git dir, matching branch.
Holding
A session using a worktree must register as a holder to prevent the background cleanup from removing it. Holder files are locked for the lifetime of the session; an unlocked marker left by a crashed process is stale and may be removed. A temporary holder protects a worktree while a session attaches.
Cleaning up
Before removal, inspect the worktree state:
- Uncommitted changes or untracked files:
git -c core.fsmonitor= status --porcelain --untracked-files=all - New commits since start:
git rev-list --count <base_commit>..HEAD
The worktree is clean only if all three are absent. If dirty, confirm with the user before proceeding — removal discards uncommitted work, untracked files, and new commits.
If the branch pre-existed (not created by this session), confirm separately
before deleting it. Re-check holders — if another session still holds the
worktree, keep it. cd out of the worktree before removing (Windows refuses
to delete a process's cwd).
Remove: git worktree remove --force <path>, then git branch -D <name> if
the branch was created this session or the user confirmed. Delete the claim
record and rmdir empty directories (never rmtree — a surviving holder
must not be lost).
Snapshotting
Before retention removes an inactive worktree, save its state to a ref: stage
all files (including untracked, excluding ignored) and commit to
refs/vibe/reaped/<name>. Use a separate index file so the worktree's own
index is untouched. Keep recovery.json after removing the active claim so
reopening a chat can recreate the checkout automatically.
Retention
Keep the newest configured number of managed worktrees across repositories.
Skip active worktrees. Snapshot each inactive excess worktree before removal;
if snapshotting fails, keep it. Reservations without a base_commit are
discarded only if empty and no creation process still holds their marker.
Creation, attachment, and retention transitions use a cross-process lock so a worktree cannot be removed while another process is claiming or attaching it.
Gotchas
- Disable
core.fsmonitorwhen reading someone else's working tree:git -c core.fsmonitor= status. - New branches start from the remote default branch, not the current checkout's HEAD.
- Symlink paths are rejected — not a stable worktree path.
git worktree addcannot distinguish a taken path from an invalid ref (both exit 128), somkdirreserves the path first.- Worktrees are implicitly trusted for the session only, not persisted.
자주 묻는 질문
worktree는 어디에 보관되나요?
Vibe 홈 안의 worktrees 폴더에, 저장소별로 묶여 보관됩니다.
worktree 이름에 공백이나 특수 문자를 쓸 수 있나요?
아닙니다. 이름은 슬래시나 물음표 같은 문자가 없는 하나의 단순한 폴더 이름이어야 합니다.
메인 프로젝트 폴더가 새 브랜치로 바뀌나요?
아닙니다. worktree는 별도의 체크아웃이므로 메인 폴더는 그대로 유지됩니다.
상세 정보
작성자의 원본 설명
Create, reuse, and clean up git worktrees under $VIBE_HOME/worktrees. Use when the user wants to work in an isolated git worktree, create a worktree for a task, or list/remove existing worktrees.
repo: mistralai/mistral-vibe
인기도
- GitHub 스타
- 5.3k
- 순위
- #15011
- 라이선스
- Apache-2.0
- 업데이트
- 2026. 11. 2.
댓글
- …