godmode:merge
Skill1 starsChanged 57 days agoMITView on GitHub
Use when the user wants to merge a branch, integrate changes, resolve conflicts, create a PR, squash-merge a feature branch, or clean up a worktree after work is done. Handles single-branch merges, PR creation and merge via gh, squash workflows, worktree cleanup, push rejection recovery, and godmode task state sync. Trigger on "merge", "merge this", "open a PR", "squash and merge", "clean up worktree", "/merge", or any variant of integrating a branch into main.
- Commits and pushes
In this repository76 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- godmode:agent-governanceSkill
- godmode:agent-improvement-loopSkill
- agents-skill-saveSkill
- baml-add-typesSkill
- godmode:brainstormSkill
- godmode:capSkill
- godmode:changelogSkill
- godmode:ci-fixSkill
- godmode:code-reviewSkill
- godmode:context-mapSkill
- godmode:cross-issueSkill
- godmode:crs-discoverSkill
- godmode:crs-hook-testingSkill
- godmode:crs-installSkill
- godmode:crs-propose-rulesSkill
- godmode:crs-validateSkill
- godmode:dead-codeSkill
- godmode:decomposeSkill
- godmode:dep-auditSkill
- godmode:dep-bumpSkill
- godmode:designSkill
- devloop-session-primerSkill
- godmode:dialecticSkill
- godmode:doc-maintainerSkill
- godmode:doc-reviewSkill
- godmode:doc-syncSkill
- godmode:doc-writerSkill
- doob-db-inspectorSkill
- doob-release-managerSkill
- godmode:doublecheckSkill
- dual-forge-pr-mergeSkill
- gh-bulk-issuesSkill
- godmode:health-scoreSkill
- godmode:ingestSkill
- godmode:introspectionSkill
- godmode:issue-triageSkill
- godmode:memory-bankingSkill
- godmode:mini-context-graphSkill
- godmode:mistake-trackerSkill
- godmode:moaSkill
- notfiles-release-workflowSkill
- godmode:observability-as-infrastructureSkill
- godmode:parallel-agentsSkill
- godmode:pattern-learnerSkill
- planning-with-cruxSkill
- godmode:pr-authorSkill
- godmode:receiving-reviewSkill
- godmode:refactoringSkill
- godmode:release-notesSkill
- release-readiness-checkSkill
- remote-upstream-triageSkill
- repo-gap-backlogSkill
- godmode:rust-conventionsSkill
- rustqualSkill
- rustqual-workspaceSkill
- rust-release-workflow-authorSkill
- godmode:self-reflectSkill
- session-wrap-commit-pushSkill
- godmode:systematic-debuggingSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
22 rules. About 0 are common, 15 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈15
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 22
Before doing anything, gather state:
- Distinctive: line 65
If only remote has new commits: continue to Direct-merge mode.
- Distinctive: line 66
If both sides diverged: resolve conflicts, then push.
- Distinctive: line 67
Never force-push to main.
- Distinctive: line 83
If main has advanced since the branch was cut, review those commits first.
- Distinctive: line 107
Read both sides — understand the intent, do not pick mechanically.
- Distinctive: line 113
If merge becomes too complex, show git diff HEAD before considering abort.
- Very specific: line 130
If no upstream: git push -u origin $(git branch --show-current) Never use --no-verify.
- Very specific: line 200
If mergeStateStatus is not CLEAN, report the blockage and stop.
- Very specific: line 204
Default: --merge (preserves merge commit, matches --no-ff)
- Distinctive: line 219
After a successful merge, check if the source branch was a worktree:
- Distinctive: line 225
If the merged branch appears as a worktree path, remove it:
- Distinctive: line 232
Only do this after confirming the branch is fully merged:
- Very specific: line 242
If a godmode task is associated with this branch, mark it done:
- Very specific: line 248
If no task ID is known, check .ctx/godmode/tasks.yaml for tasks in running state that match the branch name or scope.
- Very specific: line 262
If main..<branch> is non-empty, the merge did not complete.
- Distinctive: line 274
If a PR was created instead of merged, print the PR URL.
- Distinctive: line 275
If escalating to the user, state exactly what is blocked and what decision is needed.
- Very specific: line 282
Never --no-verify. Let hooks run.
- Distinctive: line 283
Never force-push main. Feature branches only, explicit user instruction required.
- Distinctive: line 284
Never abort a merge without showing git diff HEAD first.
- Distinctive: line 285
Never rebase branches with merge commits.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
godmode:merge — Branch Integration Agent
General-purpose merge agent. Covers single-branch merges, PR-based workflows, squash mode,
worktree cleanup, and godmode task state sync. For merging multiple parallel agent branches
produced by a wave, use godmode:wave-integration instead.
Step 0 — Assess the situation
Before doing anything, gather state:
git branch --show-current
git status --short
git log --oneline -5
git worktree listThen determine the mode (see decision table below). If the user gave explicit instructions, follow them. If ambiguous, pick the most conservative option and state your choice.
Mode decision table
| Situation | Mode |
| User said "open a PR" or "create PR" | PR-create |
| PR already open on this branch | PR-merge |
| User said "squash" or "squash and merge" | Squash |
| Multiple branches to integrate (wave) | → defer to godmode:wave-integration |
| Single feature branch, no PR | Direct-merge |
| Push was rejected | Rejection-recovery → then re-run appropriate mode |
Mode: Rejection-recovery
git push 2>&1| Output contains | Cause | Action |
non-fast-forward / fetch first | Remote has commits you don't have | Fetch, integrate, retry |
rejected ... (stale info) | Force-push needed | Ask user — feature branches only |
Permission denied | Auth failure | Check SSH key / 1Password agent |
git fetch origin
git log --oneline HEAD..origin/<branch> # commits on remote you don't have
git log --oneline origin/<branch>..HEAD # your commits not yet on remoteIf only remote has new commits: continue to Direct-merge mode.
If both sides diverged: resolve conflicts, then push.
Never force-push to main.
Mode: Direct-merge
Integrate the current feature branch into main.
1. Fetch and check divergence
git fetch origin
git log --oneline main..HEAD # commits to merge
git log --oneline HEAD..origin/main # new commits on main since branchIf main has advanced since the branch was cut, review those commits first.
2. Choose merge strategy
git log --oneline --merges main..HEAD # check for merge commits on branch- Branch has merge commits → use
git merge --no-ff(never rebase) - Branch is clean linear history →
git merge --no-ffis still the default - User explicitly requested rebase →
git rebase main(only if no merge commits)
3. Merge
git checkout main
git pull
git merge --no-ff <branch> -m "feat(<scope>): merge <branch>"4. Resolve conflicts (if any)
For each conflicted file:
- Read both sides — understand the intent, do not pick mechanically.
- Produce a merged result that preserves both intents.
git add <file>
Complete: git merge --continue
If merge becomes too complex, show git diff HEAD before considering abort. Never abort without
showing the user what would be lost.
5. Test
taskit test runFix failures (up to 3 attempts) before pushing. Escalate if not resolved.
6. Push
git pushIf no upstream: git push -u origin $(git branch --show-current)
Never use --no-verify.
Mode: Squash
Collapse all branch commits into one before merging, producing a clean linear history on main.
git checkout main
git pull
git merge --squash <branch>This stages all changes but does not commit. Write a single conventional commit summarizing the entire branch:
git commit -m "feat(<scope>): <summary of entire branch>
Squashed from <branch>:
- <key change 1>
- <key change 2>"Then push as normal.
When to use squash: Feature branches with noisy WIP commits, branches from orca-strait/parallel agents where individual commits are scaffolding artifacts, or when the user explicitly requests it.
When not to use squash: Branches where individual commits carry meaningful history (e.g., a multi-phase refactor where each commit represents a reviewable step).
Mode: PR-create
Open a pull request for the current branch.
git push -u origin $(git branch --show-current)
gh pr create \
--title "<conventional commit title>" \
--body-file - <<'EOF'
## Summary
- <bullet 1>
- <bullet 2>
## Test plan
- [ ] taskit test run passes
- [ ] clippy clean
EOFPrint the PR URL when done. Do not merge — leave that to the user or a subsequent /merge call.
Mode: PR-merge
Merge an open PR via gh.
First, check the PR state:
gh pr view --json number,title,mergeable,mergeStateStatus,reviewDecisionIf mergeStateStatus is not CLEAN, report the blockage and stop.
Choose merge style:
- Default:
--merge(preserves merge commit, matches--no-ff) - Squash requested:
--squash - Rebase requested:
--rebase(only if no merge commits on branch)
gh pr merge <number> --merge --delete-branch--delete-branch removes the remote branch after merge. Pair with worktree cleanup below if
this was a worktree branch.
Worktree cleanup
After a successful merge, check if the source branch was a worktree:
git worktree listIf the merged branch appears as a worktree path, remove it:
git worktree remove <path> --force
git branch -d <branch>Only do this after confirming the branch is fully merged:
git log --oneline main..<branch> # must be emptyTask state sync
If a godmode task is associated with this branch, mark it done:
godmode task done <task-id> --commit $(git rev-parse HEAD) --notes "merged <branch> into main"If no task ID is known, check .ctx/godmode/tasks.yaml for tasks in running state that match the
branch name or scope.
Verification
After any merge:
git log --oneline main..<branch> # must be empty — branch fully merged
git log --oneline -3 # shows merge commit at tipIf main..<branch> is non-empty, the merge did not complete. Investigate before reporting done.
Report
One-line summary when complete:
merged: <branch> -> main | <sha> | [conflicts: N files] [worktree: removed] [task: <id> done]If a PR was created instead of merged, print the PR URL. If escalating to the user, state exactly what is blocked and what decision is needed.
Key rules
git branch --show-currentbefore every commit — stop if onmainunexpectedly.- Never
--no-verify. Let hooks run. Identify and fix failures; do not bypass. - Never force-push
main. Feature branches only, explicit user instruction required. - Never abort a merge without showing
git diff HEADfirst. - Never rebase branches with merge commits.
- Worktree cleanup only after verifying
git log --oneline main..<branch>is empty. - For multi-branch wave integration, use
godmode:wave-integration.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

