merge-to-default

Verify and atomically merge a worktree candidate into the default branch as a two-parent commit.

4|Updated Jun 9, 2026
One-click install
npx skills add https://github.com/laicluse/agent-fieldkit --skill merge-to-default-laicluse
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: merge-to-default
Source: https://github.com/laicluse/agent-fieldkit/tree/main/.agents/plugins/generated/git-discipline/skills/merge-to-default
Command: npx skills add https://github.com/laicluse/agent-fieldkit --skill merge-to-default-laicluse

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Merging parallel worktree branches into a shared default branch often involves manual Git commands, lost history from squash or fast-forward merges, and race conditions when multiple agents merge concurrently. This Skill enforces a verified, atomic two-parent merge through the shared git-discipline executable. ## Core Features & Use Cases - Policy-aware merge targets: Reads the repository's git-discipline mode (local-only, auto-trunk, gated-trunk, pr-flow, external) and selects the correct local or remote merge path. - Candidate verification: Rebases the candidate onto the default tip and runs a test command at the exact candidate SHA before merging. - Atomic compare-and-swap merge: Creates a real two-parent merge commit and updates the default ref with compare-and-swap semantics, retrying on lost races. - Use Case: After finishing a feature in a git worktree, invoke this Skill to verify the candidate with your test suite, merge it into main as a two-parent commit, and hand the worktree to bonsai:prune for cleanup. ## Quick Start Ask the agent to verify and merge the current worktree candidate into the default branch using the git-discipline merge workflow.

Frequently Asked Questions about merge-to-default

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I merge a git worktree branch into the default branch?▼

Use the git-discipline executable to rebase the candidate onto the default tip, verify it with a test command at the exact candidate SHA, then run the merge command. It creates a two-parent merge commit and updates the default ref atomically.

How do I merge without losing branch history in Git?▼

Create a real two-parent merge commit instead of squash, rebase-merge, or fast-forward. The merge commit's first parent is the verified default tip and its second parent is the candidate, preserving which candidate merged into which base.

Can I merge directly to a protected default branch?▼

It depends on the repository policy mode. In pr-flow mode the default is protected and you must use the repository's PR flow; in external mode there is no write access. Local-only and auto-trunk modes permit direct local or remote updates.

What happens when two merges race to update the same branch?▼

The merge uses compare-and-swap semantics via git update-ref or a non-force push. If another merge wins first, the update fails without changing the default ref; rebase onto the new tip, rerun verification, and retry.

Why does the merge command refuse my candidate?▼

Refusals come from the git-discipline executable and reflect real state: a missing verification, a dirty worktree, a lost compare-and-swap race, or a candidate that is already integrated. Address the reported state and rerun the same command rather than using direct Git commands.