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

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

Issues, Limitations, and Mitigations

Follow-up Work