In this section, we will demonstrate how to migrate a TFVC project located on Azure DevOps. First, we will locate our project on Azure DevOps. You can do this by navigating to your organization at https://dev.azure.com. Setting up an organization is outside the scope of this book, but it is quite easy and free if you are a small company or an open source project. You can read more about this on the Azure page, here: https://azure.microsoft.com/nl-nl/services/devops/.
The project page for the git-tfs migration tool can be be found on GitHub (https://github.com/git-tfs/git-tfs). Before you install git-tfs, there are a few prerequisites you need to take into account:
- You need a Windows machine to install it with.
- It has to have Git for Windows.
The git-tfs binaries can be downloaded from https://github.com/git-tfs/git-tfs/releases. Alternatively, you can do a managed install with chocolatey (https://chocolatey.org/). Installing with such a package manager takes care of the necessary details for you. Of course, you could build the package yourself because the source is also available. For these examples, we will use a basic Windows machine I already have set up. Let's get started:
- It's easy to install Git using chocolatey:
- The next step is to install git-tfs using the gittfs package:
- In order to perform the migration, we need to create a new project in our GitLab instance so that we have a destination for our Azure DevOps project:
- Now, we will use the git-tfs tool to clone the test project we created in Azure DevOps. It will bring up an authentication window:
- It will automatically search through changesets and convert them into Git:
- To copy this local Git repository to our GitLab project, we need to create a remote entry:
c:gitMovingToGitlab>git remote add origin https://gitlab.joustie.nl:8443/root/movingtogitlab.git
- Then, we will use push -u to push it to GitLab. Git for Windows will present you with a login screen, which you can authenticate against gitlab.joustie.nl:
- When the migrations are finished, you can log in to your GitLab project. Here, you will find the pushed code:
- You can view the commit history in Git with git log:
- If you compare it with the history in TFVC, you will find it to be the same:
By using the git-tfs tool, it is relatively easy to migrate your existing TFVC to Git.