# One-Time Bidirectional Remote Backfill Sync

Date: 2026-05-20 21:25:21 EDT

## Summary

Executed a one-time two-way backfill between `github` and `forgejo`, including older GitHub-only branches and newer Forgejo-only branches, then resolved `main` divergence by fast-forwarding GitHub `main` to Forgejo `main`.

## Changes Made

- Verified remote configuration and connectivity/auth.
- Fetched and pruned both remotes with tags.
- Created safety snapshot: `.backups/2026-05-20-remote-backfill-pre-sync.bundle`.
- Computed pre-sync branch/tag differences.
- Pushed 33 GitHub-only branches to Forgejo.
- Pushed 9 Forgejo-only branches to GitHub.
- Detected and resolved `main` tip mismatch by pushing `forgejo/main` → `github/main` (fast-forward).
- Re-fetched both remotes and validated parity.

## Context

The repository transitioned from GitHub to Forgejo and retained historical refs unevenly. This turn backfilled both directions once so both remotes hold equivalent refs and commit history.

## Important Implementation Details

Key commands used:

    git remote -v
    git ls-remote --heads github
    git ls-remote --heads forgejo

    git fetch github --prune --tags
    git fetch forgejo --prune --tags

    git bundle create .backups/2026-05-20-remote-backfill-pre-sync.bundle --all

    # computed missing refs using git ls-remote + comm

    # GitHub-only branches -> Forgejo
    xargs git push --dry-run forgejo < /tmp/remote-sync/gh-only-to-fj-refspecs.txt
    xargs git push forgejo < /tmp/remote-sync/gh-only-to-fj-refspecs.txt

    # Forgejo-only branches -> GitHub
    xargs git push --dry-run github < /tmp/remote-sync/fj-only-to-gh-refspecs.txt
    xargs git push github < /tmp/remote-sync/fj-only-to-gh-refspecs.txt

    # main divergence resolution
    git push --dry-run github refs/remotes/forgejo/main:refs/heads/main
    git push github refs/remotes/forgejo/main:refs/heads/main

    # final verification
    git fetch github --prune --tags
    git fetch forgejo --prune --tags
    git log --left-right --cherry-pick --oneline github/main...forgejo/main

## Expected Impact for End-Users

Maintainers can now use either remote with consistent branch/tag availability and matching `main` history, reducing migration-era confusion and sync drift.

## Validation

- Pre-sync diff: 33 heads only on GitHub, 9 heads only on Forgejo, 0 tag deltas.
- Dry-run and real pushes succeeded for missing branches in both directions.
- Post-sync: 0 heads only on either remote, 0 tags only on either remote.
- Post-resolution: 0 common branches with mismatched tip SHAs.
- `github/main...forgejo/main` produced no divergence output after sync.

## Issues, Limitations, and Mitigations

- Initial all-branches dry-run from GitHub to Forgejo showed non-fast-forward rejection for `main`; mitigated by explicit direction-aware push (`forgejo/main` to `github/main`) after ancestry check.
- Backfill included system-like branch `__dolt_remote_info__` from Forgejo to GitHub; retained intentionally for parity.

## Follow-up Work

- No immediate follow-up required.
- If branch hygiene is desired, create cleanup issues for stale historical branches now mirrored on both remotes.
- Beads issue: `islandflow-xc5`.