I'm writing this post on 2024, However, I migrated from TFS to Git on 2020 for a company I was working for.
I'm writing this post to share my experience and the steps I followed to migrate from TFS to Git.
Why Migrate? Why Me?
The company I was working for was using TFS for source control with a local Team Foundation Server.
The company was growing and the development team was expanding.
We were working on multiple projects and the need for a distributed source control system was increasing.
So, we decided to migrate to Git.
At first DevOps team were chosen for the migration, but they said that they can't migrate the history of the source code and we will lose all the history of the source code.
So, I took the responsibility of the migration and started to search for a solution.
As I mentioned before, they used TFS with a local Team Foundation Server.
At first, I got all projects list from the local Team Foundation Server via CSS selector and saved them to a file.
Hence, Some project names were not valid as a name of a repository in Git, or they didn't follow our naming convention,
I had to change the names of the repositories.
Therefore, I added a new column to the file and wrote the new names of the repositories.
That file was like this:
Step 3: Migrate script
I wrote a script to migrate all the projects from TFS to GitLab.
Step 4: Run the script
If you run the script, it will clone all the projects to your local machine and push them to the GitLab server.
So be careful and make sure you have enough space on your machine and the GitLab server.
Double-check your connection to the TFS server and the GitLab server and also your credentials and permissions.
then run the script:
You can see the progress of the migration in the console.