Events
17 Mar, 9 pm - 21 Mar, 10 am
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Azure DevOps Services | Azure DevOps Server 2022 - Azure DevOps Server 2019
You can migrate code from an existing Team Foundation Version Control (TFVC) repository to a new Git repository within the same organization. Migrating to Git is an involved process for large TFVC repositories and teams. Centralized version control systems, like TFVC, behave differently from Git in fundamental ways. The switch involves a lot more than learning new commands. It's a disruptive change that requires careful planning. You need to think about:
Category | Requirements |
---|---|
Project access | Member of a project. |
Permissions | - View code in private projects: At least Basic access. - Clone or contribute to code in private projects: Member of the Contributors security group or corresponding permissions in the project. - Set branch or repository permissions: Manage permissions permissions for the branch or repository. - Change default branch: Edit policies permissions for the repository. - Import a repository: Member of the Project Administrators security group or Git project-level Create repository permission set to Allow. For more information, see Set Git repository permissions. |
Services | Repos enabled. |
Tools | Optional. Use az repos commands: Azure DevOps CLI. |
Note
In public projects, users with Stakeholder access have full access to Azure Repos, including viewing, cloning, and contributing to code.
Category | Requirements |
---|---|
Project access | Member of a project. |
Permissions | - View code: At least Basic access. - Clone or contribute to code: Member of the Contributors security group or corresponding permissions in the project. |
Services | Repos enabled. |
We strongly recommend reading Centralized version control to Git and the Migrate from TFVC to Git section before starting the migration.
The import experience is ideal for small, simple TFVC repositories. It's also suitable for repositories that are already clean, as outlined in Centralized version control to Git and the Migrate from TFVC to Git section. These sections also recommend other tools for more advanced TFVC repository configurations.
Important
Due to the differences in how TFVC and Git store version control history, we recommend not migrating your history, which is the approach that Microsoft took when it migrated Windows and other products from centralized version control to Git.
Select Repos, Files.
From the repo drop-down, select Import repository.
Select TFVC from the Source type dropdown
Type the path to the repository / branch / folder that you want to import to the Git repository. For example, $/Fabrikam/FabrikamWebsite
If you want to migrate history from the TFVC repository, select Migrate history and select the number of days. You can migrate up to 180 days of history starting from the most recent changeset. A link to the TFVC repository is added in the commit message of the first changeset that is migrated to Git, which makes it easy to find older history when needed.
Give a name to the new Git repository and select Import. Depending on the size of the import, your Git repository would be ready in a few minutes.
This experience is optimized for small, simple TFVC repositories, or repositories that prepared for a migration. This means it has a few limitations.
$/Fabrikam
which has one branch and one folder under it, a path to import $/Fabrikam
would import the folder
while $/Fabrikam/<branch>
would only import the branch.If any of the previously listed information is a blocker for your import, we recommend trying external tools like Git-TFS for importing and reading our whitepapers - Centralized version control to Git and the following Migrate from TFVC to Git section.
Important
The usage of external tools like Git-TFS with Microsoft products, services, or platforms is entirely the responsibility of the user. Microsoft doesn't endorse, support, or guarantee the functionality, reliability, or security of such non-Microsoft extensions.
Before you migrate source code from a centralized version control system to Git, understand the differences between the two and prepare for the migration.
To make migrations easier, there are many requirements before following the importing the repository procedure in the previous section of this article.
If the repository doesn't meet these requirements, use the Git-TFS tool to do your migration instead.
Important
The usage of external tools like Git-TFS with Microsoft products, services, or platforms is entirely the responsibility of the user. Microsoft doesn't endorse, support, or guarantee the functionality, reliability, or security of such non-Microsoft extensions.
The process to migrate from TFVC is straightforward:
.tfignore
files to
.gitignore
, and convert .tpattributes
files to
.gitattributes
.Steps 1-3 are optional. If there aren't binaries in the repository and there's no need to set up a
.gitignore
or a .gitattributes
, you can proceed directly to the Check in changes and perform the migration step.
Create a new workspace and map a working folder for the server directory being migrated to Git. This action
doesn't require a full working folder mapping. Only map folders that contain binaries to be removed
from the repository and folders that contain version control system-specific configuration files like
.tfignore
.
Once mappings are set up, get the folder locally:
tf get /version:T /recursive
Because Git stores the history of changed files by providing a copy of every file in history to every developer, checking in binary files directly to the repository can cause the repository to grow quickly and lead to performance issues.
For build tools and dependencies like libraries, adopt a packaging solution with versioning support, such as NuGet. Many open source tools and libraries are already available on the NuGet Gallery, but for proprietary dependencies, create new NuGet packages.
Once dependencies get moved into NuGet, be sure that they aren't included in the Git repository
by adding them to .gitignore
.
Team Foundation Version Control provides a .tfignore
file, which ensures that certain files aren't
added to the TFVC repository. You can use the .tfignore
file for automatically generated files like build
output so that they aren't accidentally checked in.
If the project relies on this behavior, convert the .tfignore
file to a
.gitignore
file.
Cross-platform TFVC clients also provide support for a .tpattributes
file that controls how files
are placed on the local disk or checked into the repository. If a .tpattributes
file is in use,
convert it to a .gitattributes
file.
Check in any changes that remove binaries, migrate to package management, or convert version control-specific configuration. Once you make this final change in TFVC, you can do the import.
The Git-TFS tool is a two-way bridge between TFVS and Git, and you can use it to perform a migration. Git-TFS is appropriate for a migration with full history, more than the 180 days that the Import tool supports. Or you can use Git-TFS to attempt a migration that includes multiple branches and merge relationships.
Before you attempt a migration with Git-TFS, be aware of the following fundamental differences between the way TFVC and Git store history:
A
was renamed to file B
, it only tracks
that file A
was deleted and file B
was added in the same commit.Because of these differences, we recommend that you do a tip migration and keep your TFVC repository online, but read-only, in order to view history.
To attempt an advanced migration with Git-TFS, see clone a single branch with history or clone all branches with merge history.
Important
The usage of external tools like Git-TFS with Microsoft products, services, or platforms is entirely the responsibility of the user. Microsoft doesn't endorse, support, or guarantee the functionality, reliability, or security of such non-Microsoft extensions.
Moving from a centralized version control system to Git is more than just migrating code. The team needs training to understand how Git is different from the existing version control system and how these differences affect day-to-day work.
Learn more about how to migrate from centralized version control to Git.
Events
17 Mar, 9 pm - 21 Mar, 10 am
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowTraining
Module
Migrate your repository by using GitHub best practices - Training
Learn to move your existing project to GitHub from a legacy version control system.
Documentation
Map TFVC actions to Git - Azure Repos
Learn to map Team Foundation Version Control (TFVC) commands and workflows to Git version control
Git and TFVC version control - Azure Repos
Choose which type of version control to use in Azure Repos.
Removal of TFVC in new projects
Removal of TFVC in new projects