---
name: sync-main
description: Use when the user explicitly wants the current branch synced with the repository default branch by fetching and merging carefully.
---

# Sync Main

Sync the current branch with the repo's main development branch.

## Workflow

1. Detect whether the default branch is `main` or `master`.
2. Fetch the latest remote state.
3. Merge the default branch into the current branch.
4. If conflicts appear, resolve them carefully by preserving the intent of both sides, with a bias toward keeping current feature work intact while incorporating upstream fixes.
5. Stage resolved files.

## Report

Return:

- which branch was merged
- whether the merge was clean or conflicted
- which files needed manual resolution, if any

## Rules

- Use non-interactive git commands.
- Remove all conflict markers before finishing.
- Do not push.
- Let git use the default merge commit message.
