Winning Agent Branch Merge and Cleanup

Land the selected agent branch, verify the integrated result, archive alternatives, and remove only safe session worktrees.

Development / Engineeringgitbranch-merging
by AgentVoltv1.0.0
Free to sign up · every skill included with AgentVolt Pro

Before & after

Same prompt, same agent — the only difference is the skill.

Prompt“Merge the winning branch and clean up worktrees”
Beforegeneric AI agent
Merging branches and cleaning up usually involves a few git commands. You'd want to merge the main branch into your working branch first to catch conflicts, then merge to main. After that, you delete the branches and clean up any leftover worktrees. It's good practice to archive old work for reference. You might want to write a summary of what was merged. What branch are you trying to merge?
Afterwith Winning Agent Branch Merge and Cleanup
MERGE WORKFLOW EXECUTION

STEP 1: Verify winning branch
git checkout feature/ai-optimization
git log --oneline -5
Branch verified: 8 commits, 340 lines changed

STEP 2: Merge to main
git checkout main
git pull origin main
git merge feature/ai-optimization --no-ff
Merge commit created: abc1234

STEP 3: Push and verify
git push origin main
CI checks passing; deployment ready

STEP 4: Archive losing branches
Created archive/feature-fallback-caching
Created archive/feature-cache-layer
Branches moved to archive/ prefix for reference

STEP 5: Clean up worktrees
Removed worktree: wt-testing (../wt-testing)
Removed worktree: wt-staging (../wt-staging)
git worktree list shows clean state

STEP 6: Cleanup summary
Total commits landed: 8
Files changed: 22
Testsadded: 3
Archive branches preserved: 2
Worktrees cleaned: 2

About this skill

The winning agent passed its tests, but base has moved and several worktrees still contain competing changes. This workflow lands the selected result against the actual base, preserves the alternatives, and removes session worktrees only after checking their contents and ownership.

What it does

  • Maps the winner, target branch, competing branches, and session worktrees to exact commits.
  • Detects base drift and tests the proposed integrated tree before moving the target branch.
  • Uses the repository's merge policy without silently rebasing shared history or bypassing protected branches.
  • Archives losing commits under collision-safe Git refs and verifies that each archive resolves correctly.
  • Checks tracked, untracked, ignored, and submodule changes before removing a worktree.
  • Reports the landed commit, actual checks, archive refs, retained worktrees, and any remaining blocker.

What you get

A verified local merge and a recoverable session cleanup when repository access is available. For a planning or review request, you get a scoped command sequence and explicit stop conditions; pushing, publishing, and merging a remote PR remain separate actions unless requested.

Best for

Developers using parallel coding agents in Git worktrees who have selected a winning implementation and need to land it without losing other work.

SKILL.md preview

SKILL.md
---
name: winning-agent-branch-merge-and-cleanup
description: >-
  Land a selected coding agent's Git branch by pinning commit IDs, testing its integration with the current base, archiving alternatives, and checking session worktrees before removal.
  Use when the user says "/hub:merge", "merge the winning agent branch", "land agent two's result", "archive the losing branches", "clean up this agent session", "my worktrees are piling up", or "the winner passed but base has moved".
---

# Winning Agent Branch Merge and Cleanup

… (sign up to view the full skill)
Sign up to view, copy, and install the full skill

More development skills

View all Development skills →