Syncing Azure DevOps to GitHub During Migration

How to sync ongoing Azure DevOps changes to GitHub during a phased migration.

The Problem

We migrated our source control from Azure DevOps to GitHub, but the migration was phased. The repositories moved first, but the team workflow didn't change immediately. Developers kept pushing to Azure DevOps while we prepared to switch over completely.

This meant GitHub had the initial migration, but Azure DevOps accumulated new changes. We needed to sync those changes to GitHub before switching workflows.

The Solution

The process involves adding Azure DevOps as a remote, fetching the latest changes, and pushing them to GitHub through a feature branch and pull request.

Note: This works for any Git migration. Replace the remote names and URLs with whatever systems you're syncing between.

Step-by-Step Process

1. Navigate to your repos folder

cd C:\Users\YOURNAME\repos

2. Clone the GitHub repository

git clone <GITHUB-REPO-URL>

3. Navigate into the repository

cd <REPO-FOLDER-NAME>

4. Add Azure DevOps as a remote

git remote add azure <AZURE-REPO-URL>

This creates a second remote named azure alongside the default origin (GitHub). You can now fetch from both sources.

5. Fetch changes from Azure DevOps

git fetch azure

This downloads all branches and commits from Azure DevOps without merging anything. At this point, you have both remotes available locally:

Local Repository State:
├── origin (GitHub)
│   └── main
└── azure (Azure DevOps)
    └── main (with new changes)

6. Create a feature branch from Azure's main

git checkout -b YOURNAME/github-migration azure/main

7. Push the feature branch to GitHub

git push -u origin YOURNAME/github-migration

The -u flag sets up tracking so future pushes go to the right place.

8. Create a pull request

Go to GitHub and create a PR from YOURNAME/github-migrationmain. Add AB#<task-id> to the description to link back to the Azure Boards task. We were still using Azure Boards for task tracking during the migration, so this maintained traceability between the GitHub PR and our project management system.

Why This Approach Works

Preserves history: All commits from Azure DevOps come over intact. No squashing or lost context.

Uses normal workflow: The PR process means code review happens the same way it will after the full migration.

Links work items: The AB#<task-id> syntax links the GitHub PR back to Azure Boards. Since our team was still using Azure Boards for task tracking, this kept everything connected during the transition.

Repeatable: If more Azure changes happen before cutover, run the same process again with a new feature branch.

After Cutover

Once the team switches to GitHub completely, remove the Azure remote:

git remote remove azure

The repository is now fully on GitHub with all Azure DevOps changes synced.

Conclusion

Phased migrations mean dealing with parallel changes. Adding the old system as a remote and using feature branches keeps everything organized. The process takes about five minutes per repository and maintains full history and traceability.