1.9 KiB
1.9 KiB
Merge Playbook
Use this reference when performing merges, recovering from bad worktree state, or cleaning up stale worktrees.
Standard Merge Flow
- create or enter the target worktree
- create a backup tag when appropriate
- merge or rebase the requested branch
- inspect conflicted files if any
- resolve carefully
- validate build/test/typecheck
- push or integrate only after validation
- clean up worktree and ephemeral branches
Conflict Tiers
Tier 1: Mechanical
- whitespace-only conflicts
- import ordering
- generated files
- lockfiles
Prefer regeneration over hand-merging generated artifacts and lockfiles.
Tier 2: Semantic
- both sides changed real logic
- call sites or data flow changed
- shared file needs a merged intent
Read both sides fully and merge intent, not just text.
Tier 3: Escalate Or Recreate
Use this when:
- the conflict reflects an architectural disagreement
- domain knowledge is missing
- the worktree state is easier to recreate than repair
Preferred recovery:
git merge --abort- remove the bad worktree if needed
- recreate it cleanly
- retry with a better strategy
Lockfile Handling
When a lockfile conflicts:
- do not hand-edit it
- pick the intended side or regenerate it through the package manager
- re-add the regenerated file after install/update
Stale Worktree Cleanup
If git worktree list references missing directories:
- run
git worktree prune --dry-run - inspect what will be removed
- run
git worktree prune - remove orphaned ephemeral branches only after verifying they are unused
Final Verification
Before declaring success:
git statusis clean or intentionally dirty for known reasons- no unresolved conflicts remain
- validation commands passed or the user explicitly accepted failures
- main working tree remains untouched if isolation was requested
git worktree listshows the expected final state