Moving from TFS to git while maintaining changeset and branch history

January 14, 2015 - 12:00 am

So, you’re also looking to move from TFS to git? Lucky you! 🙂 There’s a Git <-> TFS bridge available to help you out with that; but the latest release doesn’t fully support branching, so if you need branches as well you’ll need to grab the code from this pull request instead.

In order to grab it, you can do the following..

git clone https://github.com/git-tfs/git-tfs C:/workspace/git-tfs (or wherever you want to store it locally)
cd c:/workspace/git-tfs
git remote add pmiossec https://github.com/pmiossec/git-tfs.git
git fetch pmiossec
git checkout pmiossec/rename_branch_and_add_file

Now you just need to load up the GitTfs.Sln in Visual Studio. Unload the projects that don’t match your installed Visual Studio version. Build the rest. Grab the binaries from GitTfs/bin/Debug. You’ll also need a dll from lib\libgit2sharp\LibGit2Sharp\bin\Debug\NativeBinaries. (amd64 for 64 bit CPU, x86 for 32 bit CPU).

Now you should be good to go. Verify that you’re using the correct version by using git-tfs version. It should be 0.20.0.0

To clone your TFS repository, use this:

git-tfs clone --username=<USER> --password=<PASSWORD> <TFS_URL> <TFS_BRANCH> <LOCAL_PATH>
--with-branches

For example.

git-tfs clone --username=Emil --password=c0deb0ss https://codeboss.visualstudio.com/DefaultCollection $/AwesomeProject/Main C:/workspace/awesome-project --with-branches

Any questions? Just tweet me at @EKantis and I’ll get back to you. Cheers!