When migrating repositories from GitHub Enterprise Server (GHES) to GitHub.com, fork relationships are not preserved. As a result, any work‑in‑progress branches that exist only in forks will not automatically transfer. This document provides a step‑by‑step manual workflow to identify active branches in forks, bring them into the upstream repository, and ensure all relevant work is preserved before migration. The process works for:
- Individual developer forks
- Team‑maintained forks
- Long‑running feature branches
- Stale but important historical branches
On GHES, navigate to the upstream repository:
Repository → Insights → Network
This view shows:
- All forks
- Branch activity
- Divergence from upstream
Alternatively, use the API:
curl -H "Authorization: token <TOKEN>" \
https://<GHES_HOST>/api/v3/repos/<ORG>/<REPO>/forksFor each fork:
git fetch https://<GHES_HOST>/<USER>/<FORK>.git
git branch -rThen compare each branch to upstream:
git log upstream/main..origin/<branch>If commits appear, the branch contains work not present in upstream.
git clone https://<GHES_HOST>/<ORG>/<REPO>.git
cd <REPO>For each fork:
git remote add fork-<username> https://<GHES_HOST>/<USER>/<FORK>.git
git fetch fork-<username>There are two recommended approaches depending on your preference for history.
git checkout -b wip/<username>/<branch> fork-<username>/<branch>git push origin wip/<username>/<branch>This preserves:
- Commit history
- Author information
- Merge context
If you want a cleaner history:
git checkout -b wip/<username>/<branch> fork-<username>/<branch>git rebase -i upstream/maingit push origin wip/<username>/<branch>git log upstream/main..origin/wip/<username>/<branch>For each fork branch:
git log fork-<username>/<branch>..origin/wip/<username>/<branch>If no commits appear, the branch is fully preserved.
Once all WIP branches are pushed into the upstream repository:
- The migration tool (GitHub Enterprise Importer, GitHub CLI, or API‑based migration) will include these branches.
- Developers will no longer rely on fork relationships.
- All active work is now centralized in the upstream repo.
After the repository is live on GitHub.com:
Developers can fork the migrated repository again.
Apply policies to the new wip/* branches if required.
Encourage developers to open pull requests from the preserved branches into main or other targets.
This workflow ensures:
- No work‑in‑progress is lost
- All fork‑based development is captured
- Migration to GitHub.com is clean and complete
- Developers retain their work without needing fork relationships It’s a simple, reliable, and repeatable process that works for organizations of any size.