Winning Agent Branch Merge and Cleanup
Land the selected agent branch, verify the integrated result, archive alternatives, and remove only safe session worktrees.
Before & after
Same prompt, same agent — the only difference is the skill.
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?
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
---
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)More development skills
View all Development skills →Performance Bottleneck Profiling: Node, Python, Go
Classifies a slowdown, gives exact profiler commands, reads the output, and proves the fix with same-conditions p95/p99 numbers.
Feature Scaffolding with Working Tests
Turn a short feature spec into code, runnable tests, and integration wiring that match your existing project.
Feature Flag Rollouts and Kill Switches
Design staged flag rollouts, verify rollback paths, and audit flag debt with explicit defaults, gates, and retirement plans.
Microcontroller Firmware and RTOS Engineering
Build and debug MCU firmware with bounded ISR/RTOS timing, safe DMA ownership, and measured power budgets.