DEV Community

Kailash Nirmal
Kailash Nirmal

Posted on

From Azure to GitLab: Safely Migrating Active Development Work During a Repository Migration

Introduction

Repository migrations are often perceived as straightforward infrastructure activities. In reality, developers frequently face a more complicated challenge:

"What happens to the work that is already in progress?"

I recently faced a situation where an ongoing feature was being developed in a repository originally hosted in one Git platform while the organization migrated to another platform.

The challenge was not simply moving code.

The challenge was safely migrating active work without:

  • Losing commits
  • Pushing to deprecated branches
  • Creating merge conflicts
  • Breaking the development workflow
  • Introducing confusion among team members

This article summarizes the lessons learned and the approach that ensured a smooth transition.

The Situation

The development team received guidance similar to:

Stop pushing to branches originally created in the old repository platform.
Create new branches in the new platform.
Verify branch history before using migrated branches.
Use new authentication credentials for the new platform.

At first glance the instructions seemed simple.

However, there was already:

  • Ongoing feature development
  • Local commits
  • Existing branch history
  • Local test configurations
  • New authentication requirements

The biggest question became:

"How can existing work be moved safely without starting over?"

Step 1: Verify the Current State

Before making any migration-related changes, it is important to understand exactly where the work exists.

A few simple checks help answer:

  • Which branch am I on?
  • Are there uncommitted files?
  • Have commits already been created?
  • Which remote repository am I connected to?

Understanding the current state prevents accidental mistakes later.

One of the most valuable lessons was:

Never assume your local branch matches the remote branch.

Verify first.

Act second.

Step 2: Separate Real Changes from Local Testing

In most projects there are usually two types of modifications:

Functional Changes

Actual feature development or defect fixes intended for source control.

Local Testing Changes

Temporary configuration updates such as:

  • Application settings
  • Local environment values
  • Debugging configurations

During migration these should be treated differently.

Only genuine feature work should be committed and shared.

Local test settings should remain local.

This reduces unnecessary review noise and prevents environment-specific changes from reaching other developers.

Step 3: Preserve Existing History

One mistake that developers sometimes make during migrations is attempting to recreate work from scratch.

Instead, preserve existing history.

Every commit represents:

  • Design decisions
  • Development effort
  • Traceability
  • Context for reviewers

The goal is not to rebuild the work.

The goal is to move it safely.

Step 4: Keep the Original Remote as a Backup

A valuable practice during migration is retaining the old repository connection.

Rather than deleting the old remote immediately:

  • Keep it as a backup reference.
  • Add the new repository as the primary remote.

This approach provides confidence during migration because historical references remain available if needed.

Think of it as:

Old Repository

Safety Net

New Repository

Future Development

Keeping both during the transition minimizes risk.

Step 5: Create a New Branch in the New Platform

One critical lesson from repository migrations is:

Do not assume migrated branches are safe to continue using.

Even if branch names appear identical, commit histories may differ.

Instead:

  1. Start from your existing local work.
  2. Create a fresh branch in the new platform.
  3. Push the branch there.

This creates a clean migration path.

Benefits include:

Easier auditing
Cleaner history
Reduced synchronization problems
Compliance with migration guidelines

Step 6: Configure New Authentication

Repository migrations frequently require new credentials.

In many modern systems this means:

Personal Access Tokens (PATs)
Fine-grained access controls
New authentication policies

A common mistake is attempting to reuse credentials from the previous platform.

Instead:

  • Create new credentials.
  • Apply least-privilege principles.
  • Store tokens securely.
  • Revoke exposed credentials immediately if accidentally shared.

Security should never be an afterthought during migration.

Step 7: Synchronize with the Latest Team Changes

Before opening a merge request, it is important to ensure the branch includes recent updates from the target branch.

This step helps:

  • Reduce future merge conflicts
  • Increase build stability
  • Simplify code reviews

In our case, synchronizing before the merge request ensured the branch contained both:

  • The new feature work
  • The team's latest changes

This significantly reduced integration risk.

Step 8: Push and Verify

A successful push is not the end of the process.

Verification remains important.

After pushing:

  • Confirm the branch exists remotely.
  • Verify commit history.
  • Ensure expected files are present.
  • Confirm unwanted local files are absent.

Trust, but verify.

Step 9: Review Before Creating the Merge Request

Before opening the merge request:

Review:

  • Changed files
  • Commit messages
  • Branch target
  • Merge history

The reviewer's experience improves significantly when the merge request is clean and focused.

A well-prepared merge request often receives faster approvals and generates fewer comments.

Key Lessons Learned

The migration reinforced several important engineering practices:

  1. Never Rush Repository Migrations

Small mistakes can result in:

  • Lost work
  • Duplicate branches
  • Broken histories
  • Keep Local Work Organized

Separate:

  • Production changes
  • Experimental changes
  • Local configurations
  • Verify Before Pushing

Always confirm:

  • Current branch
  • Remote destination
  • Intended target branch
  • Security Matters

Access tokens should be:

  • Generated securely
  • Used carefully
  • Revoked if exposed
  • Communication Is Critical

Clear migration guidance from team leads significantly reduces confusion and prevents repository fragmentation.

Conclusion

Code migrations are rarely just technical exercises.

They are operational change events that require:

  • Careful planning
  • Communication
  • Source control discipline
  • Security awareness

By preserving local work, creating new branches, synchronizing with the latest changes, and validating every step before submitting a merge request, developers can transition smoothly between repository platforms without disrupting delivery.

Most importantly, repository migrations remind us of a simple software engineering principle:

Successful migrations are not about moving code. They are about moving work safely.

Hope this was helpful!

Thanks,
Kailash
JavaCharter

Top comments (0)