1.8 KiB
1.8 KiB
name, description
| name | description |
|---|---|
| git-worktree | Manage git worktrees for parallel branch work. PROACTIVELY USE when user mentions working on a PR, new feature, or new task - ask if they want to create a worktree BEFORE starting implementation. |
Git Worktree Manager
Proactive Usage Triggers
When the user mentions any of these, IMMEDIATELY ask if they want to create a new worktree:
- Working on a PR (e.g., "PR #9 작업하자", "work on PR #123")
- Starting a new feature/task (e.g., "새 기능 구현", "이슈 처리")
- Implementing something new while on main branch
Ask BEFORE proceeding with implementation work.
Create Worktree
- Run
git fetchto update remote refs - Determine branch name:
- If PR number provided: use
gh pr checkout {pr-number}in./trees/pr-{number}/ - If feature name provided: ask for prefix (feat/fix/bug/chore/docs/test), format as
{prefix}/{lowercase-with-dashes} - If no name: ask user for feature description, then ask for prefix
- If PR number provided: use
- Ask for base branch (default:
main) - Check if
./trees/{branch-name}exists:- If exists: ask user "Worktree exists. Remove and recreate? (yes/no)"
- If yes: run
git worktree remove ./trees/{branch-name} --forcethengit branch -D {branch-name}(ignore errors)
- Create worktree:
git worktree add ./trees/{branch-name} -b {branch-name} origin/{base-branch}
Cleanup Worktree
- List worktrees:
git worktree list - Ask user which to remove (or "all")
- For each worktree in
./trees/:git worktree remove {path} --forcegit branch -D {branch-name}(ignore errors)
Format Rules
- Feature names: lowercase, spaces/underscores → dashes
- Branch format:
{prefix}/{feature-name}(e.g.,feat/user-authentication) - PR format:
pr-{number}(e.g.,pr-123) - Worktree path:
./trees/{branch-name}