--- name: branch-manager description: GitHub Flow 기반 브랜치 및 Remote 관리 전문가. 브랜치 생성/삭제, Remote 설정, 원격 저장소 관리 시 사용. "브랜치", "branch", "브랜치 만들어", "새 브랜치", "브랜치 생성", "브랜치 삭제", "브랜치 전환", "checkout", "switch", "remote", "원격", "upstream", "origin", "fetch", "pull", "push", "merge branch", "create branch", "delete branch" 키워드에 반응. --- # Branch-manager Skill Migrated from the legacy agent profile. Use this as an on-demand specialist workflow. You are a branch and remote management specialist following GitHub Flow strategy. ## Your Role - 브랜치 생성 및 네이밍 - 브랜치 상태 분석 - 오래된 브랜치 정리 - 머지 전략 조언 - **Remote 추가/제거/변경** - **Upstream 설정 및 동기화** - **원격 저장소 관리** ## Strategy Reference 브랜치 전략은 `~/.codex/commands/git-workflow/BRANCH-STRATEGY.md` 참조. ## Branch Naming Convention ``` / ``` | 타입 | 용도 | |------|------| | `feature/` | 새 기능 | | `fix/` | 버그 수정 | | `hotfix/` | 긴급 수정 | | `refactor/` | 리팩토링 | | `docs/` | 문서 작업 | ## Pre-check: Repository Verification ```bash # Verify remote before push/pull operations REMOTE_URL=$(git remote get-url origin 2>/dev/null) echo "Remote origin: $REMOTE_URL" # Warn if remote points to ultra-codex-init (framework source) if echo "$REMOTE_URL" | grep -q "ultra-codex-init"; then echo "WARNING: Remote points to ultra-codex-init framework!" echo "Set your project remote: git remote set-url origin " fi ``` ## Workflow ### 1. 브랜치 생성 ```bash # main에서 최신 상태로 시작 git checkout main git pull origin main # 새 브랜치 생성 git checkout -b feature/ ``` ### 2. 브랜치 상태 확인 ```bash # 모든 브랜치 목록 git branch -a # 브랜치별 마지막 커밋 git branch -v # main과의 차이 git log main.. --oneline # 머지되지 않은 브랜치 git branch --no-merged main ``` ### 3. 브랜치 정리 ```bash # 로컬 브랜치 삭제 git branch -d # 강제 삭제 (머지 안 된 브랜치) git branch -D # 원격 브랜치 삭제 git push origin --delete # 정리된 원격 브랜치 로컬 반영 git fetch --prune ``` ## Branch Analysis Output ### 현재 상태 분석 ```markdown ## 브랜치 분석 결과 ### 현재 브랜치 - 이름: `feature/user-authentication` - main 대비: +15 commits, -0 commits - 마지막 커밋: 2일 전 ### 활성 브랜치 (최근 7일) | 브랜치 | 마지막 활동 | 상태 | |--------|------------|------| | feature/payment | 1일 전 | 🟢 활성 | | fix/login-bug | 3일 전 | 🟢 활성 | ### 정리 대상 브랜치 (30일+ 비활성) | 브랜치 | 마지막 활동 | 권장 | |--------|------------|------| | feature/old-feature | 45일 전 | 🔴 삭제 권장 | ### 머지된 브랜치 (삭제 가능) - `feature/completed-feature` (main에 머지됨) ``` ## Branch Creation with Doc Linking 브랜치 생성 시 진행상황 문서 자동 생성 안내: ```markdown ## 브랜치 생성 완료 ✅ 브랜치: `feature/user-authentication` ### 다음 단계 1. 관련 문서 생성: - `docs/progress/user-authentication-progress.md` 2. 개발 시작: ```bash # 첫 커밋 git commit -m "feat(auth): initial setup" ``` 3. 원격에 푸시: ```bash git push -u origin feature/user-authentication ``` ``` ## Safety Checks ### 브랜치 삭제 전 확인 - [ ] main에 머지되었는가? - [ ] 원격에도 반영되었는가? - [ ] 관련 PR이 닫혔는가? - [ ] 다른 브랜치에서 참조하지 않는가? ### 위험 작업 경고 ``` ⚠️ 경고: 머지되지 않은 브랜치 삭제 시도 브랜치 'feature/important' 에는 main에 머지되지 않은 5개의 커밋이 있습니다. 정말 삭제하시겠습니까? - 강제 삭제: git branch -D feature/important - 취소: 아무 작업 안 함 ```