C.W.K.
Stream
Lesson 11 of 13 · published

Git 통합과 Worktree

~18 min · git, worktrees, checkpoints, rewind, parallel

Level 0🌱 입문자
0 XP0/70 lessons0/11 achievements
0/120 XP to next level120 XP to go0% complete

git stash 지옥 없는 병렬 작업

Claude Code 는 git-native. 모든 파일 edit 가 checkpoint 만들고; /rewind 또는 Esc Esc 가 롤백. 에이전트가 자연어로 commit, branch, rebase, PR 초안. 더 큰 패턴: worktree 가 단일 repo 를 N 병렬 workspace 로 바꿔, worktree 하나당 Claude 세션 하나, 파일 충돌 X.

Worktree 가 진짜 문제 해결: 반쯤 끝난 branch 셋, git stash 로 context 갈아엎기 싫고, working dir 공유는 절대 싫어. git worktree add 가 다른 branch 에 핀된 형제 디렉토리 만들어. 각각에 Claude 세션 켜. commit history 공유, 파일 안 공유.

Claude Code 의 --worktree <name> 이 그 안무 자동화: .claude/worktrees/<name>/ 만들고, origin/HEAD 에서 branch 따고, 떨어뜨려. /batch 가 더 멀리 — 큰 리팩토링을 독립 단위로 분해, 단위별로 background agent spawn (각자 worktree 안), 각자 PR 열어. 격리된 채로 각각 리뷰.

Code

Parallel sessions, no stash·bash
# Three worktrees in three terminals
claude --worktree feature-auth     "implement OAuth2 login"
claude --worktree bugfix-payment   "fix the null in checkout"
claude --worktree perf-search      "profile and fix slow search"

# All three running simultaneously
# Each touches its own files, all share git history

# Manual equivalent
git worktree add -b feat/x ../x origin/main
cd ../x && claude

# Cleanup when shipped
git worktree remove ../x
/batch — fleet of agents in one shot·bash
# Inside a session
/batch migrate every Express 4 route in src/routes/ to Express 5

# Claude:
# 1. Lists matching files (decomposition)
# 2. Shows you a plan with one unit per file
# 3. On approval: spawns one background agent per unit
# 4. Each agent in its own worktree, implements, runs tests
# 5. Each unit opens its own PR
# You review and merge independently

External links

Exercise

실제 repo 잡아. worktree 두 개에 병렬 Claude 세션 두 개 spinup, 각자 같은 codebase 의 다른 작업. 서로 파일 안 부딪치는지 확인. git stash 기반 병렬 작업이랑 어떻게 다른지 적어.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.