You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何将TFVC仓库从一个VSTS实例迁移至另一个VSTS实例

Alright, let's figure out how to migrate your TFVC repo from one Azure DevOps Services (formerly VSTS) instance to another—keeping all your source code and full history intact, no work items involved. I get it, most guides either focus on on-prem TFS or converting to Git, so here are the practical, reliable methods tailored exactly to your TFVC-to-TFVC scenario:

This is the go-to tool for cross-instance Azure DevOps migrations, and it fully supports TFVC-to-TFVC history migration. It handles the heavy lifting of transferring all your changesets seamlessly.

  • Step 1: Install the tool
    Open PowerShell as an administrator and run:

    Install-Module -Name AzureDevOpsMigrationTools
    

    If you prefer not to use PowerShell modules, you can grab the latest release package directly from the tool's official repo.

  • Step 2: Configure your migration settings
    Generate a starter config file with:

    Export-MigrationToolConfig -ConfigFile .\tfvc-migration.json
    

    Open the tfvc-migration.json file and update these key sections:

    • Under Source, set CollectionUri to your source VSTS instance (e.g., https://source.visualstudio.com/DefaultCollection) and ProjectName to your source project.
    • Under Target, set CollectionUri to your destination VSTS instance (e.g., https://destination.visualstudio.com/DefaultCollection) and ProjectName to your target project.
    • Find the TfvcMigrationProcessor in the Processors array, then set SourcePath (the TFVC path you want to migrate, like $/SourceProject/Main) and TargetPath (the empty path in your target repo, like $/DestProject/Main). Make sure the target path doesn't exist yet—the tool will create it automatically.
  • Step 3: Run the migration
    Execute the migration with:

    Invoke-Migration -ConfigFile .\tfvc-migration.json
    

    The tool will walk through every changeset from your source repo and replicate it to the target. Keep an eye on the PowerShell output for progress updates—this might take a while depending on the size of your repo and number of changesets.

Method 2: Manual Migration (For Small Repos Only)

If your TFVC repo is small and you don't mind a bit of manual work, this method works—but note that it won't preserve full changeset history (it'll push all files as a single initial check-in). Only use this if you don't need to retain individual changeset details:

  • Step 1: Clone the source repo locally
    Use the TF command line tool (included with Visual Studio or the standalone TFS SDK) to clone the full source:

    tf clone https://source.visualstudio.com/DefaultCollection/SourceProject $/SourceProject/Main C:\LocalTFVCCopy /all
    

    The /all flag pulls all file versions, not just the latest.

  • Step 2: Set up the target repo
    In your destination VSTS instance, create a new project (or use an existing one) and ensure TFVC is enabled (it's on by default, but double-check in Project Settings > Repos). Create an empty root path for your migrated code (e.g., $/DestProject/Main).

  • Step 3: Push to the target
    Create a new workspace linked to the destination instance:

    tf workspace /new /collection:https://destination.visualstudio.com/DefaultCollection DestWorkspace
    

    Map your local clone to the target TFVC path:

    tf workfold /map $/DestProject/Main C:\LocalTFVCCopy
    

    Finally, check in all files:

    tf checkin /recursive /comment:"Initial migration from source VSTS instance"
    
Key Tips for a Smooth Migration
  • Backup first: Take a snapshot of your source repo before starting—better safe than sorry if something goes wrong.
  • Lock source branches: If possible, lock the source TFVC branches during migration to prevent new changes from being added mid-process (avoids conflicts and missing history).
  • Validate post-migration: After the migration finishes, spot-check a few key changesets in the target repo to ensure all files and history match the source.

内容的提问来源于stack exchange,提问作者Jason Butler

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 09:31:49