| name | branch-merging |
| description | Skill for safely merging completed agent branches back to main. Covers pre-merge checks, conflict resolution, post-merge cleanup, and promotion of newly unblocked tasks.
|
| user-invocable | true |
| disable-model-invocation | false |
Branch Merging
Use this skill when merging completed agent work back to the main branch.
Pre-Merge Checklist
Before merging, verify:
-
Task is closed in Beads:
bd show <task-id>
-
All tests pass on the agent branch:
cd <worktree-path>
npm test / pytest / go test ./... / cargo test
-
Review changes:
git log main..<branch> --oneline
git diff main..<branch> --stat
git diff main..<branch>
Merging
Using the merge script:
./scripts/merge-agent.sh <branch-name> <task-id>
Manual merge:
git checkout main
git pull --rebase
git merge <branch> --no-ff -m "Merge <branch>: agent work complete"
git push origin main
Conflict Resolution
If git merge fails with conflicts:
- Identify conflicting files:
git diff --name-only --diff-filter=U
- Resolve conflicts manually or with a merge tool
git add <resolved-files>
git commit (merge commit message is pre-populated)
git push origin main
Post-Merge Cleanup
git worktree remove <worktree-path>
git branch -d <branch-name>
tmux kill-window -t <session>:<branch>
git worktree prune
Promoting Unblocked Tasks
After merging, check for newly available work:
bd ready
If tasks are now unblocked, dispatch new agents:
./scripts/spawn-agent.sh <task-id> agent-<name> "<description>"
Merge Order Strategy
When multiple branches are ready to merge:
- Merge branches that unblock the most downstream tasks first
- Merge smaller changesets before larger ones (easier conflict resolution)
- Run the full test suite after each merge before proceeding