Main Sync (internal)
This internal document mirrors the public @gh-main boundary.
Ownership split
@gh-main: switch tomain, fetch remotes, integrate canonicalmain, resolve conflicts.@gh-reset: destructive reset/clean only when explicitly requested.@gh-push: publish only.
Internal flow
- Validate repo.
- Checkout local
main(create fromorigin/mainif needed). - Fetch
originandupstreamwhen available. - Choose canonical
main(upstream/mainelseorigin/main). - Merge canonical
maininto localmain(prefer ff-only, resolve conflicts if required). - Verify branch and merge state.
Command runbook
1) Validate repository and switch to main
git rev-parse --is-inside-work-tree
git checkout main
If local main does not exist:
git checkout -b main origin/main
2) Fetch remotes
git fetch origin
If upstream exists:
git fetch upstream
3) Resolve canonical root branch
- Prefer
upstream/mainwhen upstream is source of truth. - Otherwise use
origin/main.
4) Merge canonical root into local main
Prefer fast-forward:
git merge --ff-only "$ROOT_BRANCH"
If fast-forward is not possible, run a normal merge and resolve conflicts:
git merge "$ROOT_BRANCH"
5) Final verification
git branch --show-current
git status --short
git log -1 --oneline
No reset/clean commands are part of this internal main-sync executor.