Migrating from TFVC to git

19 Nov 2016

git tfs

In case you would like to move old projects from TFVC to git.

There is nice command line utility git-tfs that allows you to move projects source history from tfvc to git (it also allows you to do whole bunch of other things).

This post requires Chocolatey to be installed on your system

#install git-tfs with chocolatey
choco install gittfs -y

#get all project branches to git repository 
#git-tfs clone "<your tfs collection url>" "<your tfs project branch>" --branches=all
git-tfs clone "https://mateuszligeza.visualstudio.com/DefaultCollection" "$/BranchingTest/master" --branches=all

#add new remote for repository
git remote add origin https://mateuszligeza.visualstudio.com/DefaultCollection/_git/BranchingTestGit

#push all local branches to origin
git push -u origin --all

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.