This blog is the final part of a series.

← Read Part 3: How We Moved from TFS to git: Owning git (cont’d)

 

To ensure a successful migration, you need to follow these key steps:

  1. Choose the repository strategy.
  2. Choose the branching strategy.
  3. Integrate git in your CI/CD pipeline.
  4. Train your newbies.
  5. Migrate your code.
  6. Delete the TFVC repositories.
  7. Stay informed of TFS releases that close the feature gap with other git servers.

 

Our Own Migration Journey

Once the department’s key players were convinced migration to git was a must, we had to get it done. The following steps were taken in order to successfully migrate our code base.

 

Training

First things, first. Training has proven to be important, especially when talking git. Two one-hour opt-in sessions took place (basic and advanced) so people with weaker l background could attend and people with stronger backgrounds could be identified as mentors to newbies.

Migration note: Hands-on sessions with real-life situations are key here. Theory has to be kept to a minimum. People interested in git plumbing will google it for themselves. Others will rely on training to solve everyday problems. Remember to train your members as close to the migration date as possible.

 

Pull Requests

We decided to use pull requests for code reviews, since this has been included in TFS. We could have used something like gerrit, but past experience some developers have had with collaboration and continuous integration told us this solution wouldn’t work.

We protect the master branch with pull requests, mandating the work item to be linked, a reviewer to accept the changes and whenever possible, a build to be successful. This created an interesting situation in which our pipelining was implemented using Jenkins. The Jenkins hook in TFS wasn’t suitable for our needs. Therefore, we had to configure a TFS build. Its only purpose was to trigger a Jenkins pipeline and wait for the result. The result is then translated into a TFS build result. This has the advantage of forcing a pull request to succeed a given pipeline before merging it into the master branch. This gives us confidence that a production-ready master branch is available at all times.

Migrating Code

Whenever possible, we tried to migrate the history along from TFS to git. For this purpose, we used git-tfs. However, there were some occasions when commits were too large for the HTTP transport to push on the remote. Note here we were forced to use HTTP since TFS did not support SSH (Secure Socket Shell) at the time. Therefore, while the local repository was fine, we were stuck with not being able to push it. We had to decide not to bring the history with the code for the first few repositories. However, we discovered the Visual Studio git client applies some tricks, so we were able to push all commits.. The final recipe was to use git-tfs to create the local repository and then Visual Studio to push it to TFS. The steps are:

  1. Create the repository on TFS
  2. Protect at least the master with pull requests
  3. Migrate the code with git-tfs
  4. Push the local repository using Visual Studio’s git client

Finally, there were decisions made to create distinct repositories per application or component.

 

Kill Switch

Finally, the department needs the courage to say farewell to TFVC. The longer the department lives in a limbo state between TFVC and git, the more disgruntled the members will be. Past experience shows us that the CI/CD pipelining prevents us from turning on the kill switch Therefore, the pipeline has to be git-ready prior to migrating the code. Once the code is migrated, the associated pipeline is adapted quickly and downtime is reduced to a minimum.

 

← Read Part 3: How We Moved from TFS to git: Owning git (cont’d)

 

cumulus-banner-survey-v2-en

Written by Guy Lépine Employee @ SherWeb

Guy Lépine has a degree in Computer Engineering from the Royal Military College of Canada in Kingston, Ont. He has worked as a computer engineer in the private sector and has also held jobs as a software developer in various application domains. Guy has a diploma in Project Management from the Université de Québec à Montréal and in Electrical Engineering Specializing in Computer Security from the Université de Sherbrooke. Guy has participated in several software development projects using the Agile methodology.