Syncing Azure DevOps to GitHub During Migration

Syncing ongoing Azure DevOps changes to GitHub during a phased migration.

Background

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 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.

Sync 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.

This preserves all commits from Azure DevOps intact. The PR goes through normal code review. If more Azure changes happen before cutover, run the same process again with a new feature branch.

Post-Migration Cleanup

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. The process takes about five minutes per repository and maintains full history and traceability.