
git-worktree-manager
by VictorHueni
This Repo contains my template app (PostgreSQL + Spring + React) with CI/CD
SKILL.md
name: git-worktree-manager description: Manages the lifecycle of Git worktrees for parallel development tasks. Handles creation, safe removal, and branch management to keep the main working directory clean.
Git Worktree Manager Skill
This skill enables the agent to safely create, manage, and destroy Git worktrees. This allows for parallel development (e.g., fixing a bug while in the middle of a feature) without disrupting the main working directory.
1. Directory Strategy
To prevent path resolution issues and nesting conflicts, all worktrees MUST be created as siblings to the current project root.
- Current Root:
../project-name - Worktree Root:
../project-name-<feature>
Example:
If working in P:/dev/my-app, a worktree for a "auth-fix" should be at P:/dev/my-app-auth-fix.
2. Worktree Protocols
PROTOCOL:WORKTREE_CREATE
Trigger: When the user needs to switch contexts (e.g., "fix this bug" while changes are unstaged) or explicitly requests a clean environment.
- Analyze Request: Determine the target branch name and the purpose.
- Determine Path: Construct the sibling path
../<current_folder_name>-<short-description>. - Execute Creation:
- New Branch:
git worktree add ../<path> -b <branch-name> - Existing Branch:
git worktree add ../<path> <branch-name>
- New Branch:
- Confirm: Report the location of the new worktree and remind the user that dependencies (like
node_modules) may need to be re-installed there.
PROTOCOL:WORKTREE_REMOVE
Trigger: When the task in the worktree is complete and changes are committed.
- Verify State: Ensure changes in the worktree are committed or stashable.
- Execute Removal:
- Attempt standard removal:
git worktree remove <path> - Handle Untracked Files: If the command fails because of untracked files (e.g.,
node_modules,target/), and the work is definitely saved/committed, use force:git worktree remove --force <path>.
- Attempt standard removal:
- Prune: Run
git worktree pruneto clean up references.
3. Operational Guidelines
- Dependency Awareness: A new worktree is a fresh checkout. It does not share
node_modules,target, orvenvfolders. You MUST check for their existence and run install commands (npm install,./mvnw compile) before running tests in the new worktree. - Path Context: When operating in a worktree, always use absolute paths or relative paths carefully calculated from the worktree root.
- Shell Context: When running shell commands, explicitly
cdinto the worktree directory:cd ../<worktree-path>; <command>.
スコア
総合スコア
リポジトリの品質指標に基づく評価
SKILL.mdファイルが含まれている
ライセンスが設定されている
100文字以上の説明がある
GitHub Stars 100以上
3ヶ月以内に更新がある
10回以上フォークされている
オープンIssueが50未満
プログラミング言語が設定されている
1つ以上のタグが設定されている
レビュー
レビュー機能は近日公開予定です