TFVC to GIT to TFVC – is it possible?

YES! It is possible.

Well, there it is not very straight forward but after you get the correct tools, then it becomes very easy.


In my tests I first converted a project from TFVC to GIT, it was done using the tool git-tfs. The easiest way to install it, it is using Chocolatey, with the command: choco install gittfs

After done the installation you can simply convert any TFVC in GIT, you can read more details in the previous link or simply run the command to fetch all the history for all branches:

git tfs clone $/project/trunk . --branches=all


After that you must push the changes to a GIT repository:

git remote add origin

For TFS your repository is found with this URL standard: http://yourserver:8080/tfs/Collection/ProjectName/_git/GitRepository (or https, changing the port to 443)

Now you can push the content:

git push --all origin


Then in the history, you can see this result comparing TFVC and GIT repositories:

As you can see above all history was kept, even the dates and who did the change. Until here we have a great tool to move our TFVC project to GIT without losing any history.


For this move I am using another tool, git-tf,  also it is very simple. Simple execute the code below to configure the git-tf tool:

git tf configure http://yourserver:8080/tfs/Collection “$\TeamProjectName” –force

I’m using the flag “force” to ensure that the configuration is being applied. Then you must check-in your project to the new team project:

git tf checkin –deep –autosquash –keep-author

Look how the history looks for GIT and TFVC now:


The new TFVC is created with the history, but the dates are not kept unfortunately the tool has such limitation.


Anyway, this approach can help some people to simply move from one to another.


TFS API to manipulate your server Workspaces

Hi all, one in a while we need to do some changes within our TFS Build process template, and a easy way to do it is using powershell in pre or post build command.

I will add a sample code to find the current workspace and then you can program what you need from this point on.


# load the needed client dll’s

#here I’m considering that your workspace is one folder up

$rootBuildPath = (get-item $PSScriptRoot ).parent.FullName

#here I get the workspaces set for that local folder

$workspaceInfos = [Microsoft.TeamFoundation.VersionControl.Client.Workstation]::Current.GetLocalWorkspaceInfoRecursively($rootBuildPath)

#here I can get the tfs collection

$tfsCollection = [Microsoft.TeamFoundation.Client.TfsTeamProjectCollectionFactory]::GetTeamProjectCollection($workspaceInfos[0].ServerUri);

#then I can get the version control service

$vc = $tfsCollection.GetService([type] “Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer”);

#and for example, download something

$fileXml = Join-Path -Path $rootBuildPath -ChildPath “file.xml”
$itemToDownload = $vc.GetItem(“$/teamProjectName/file.xml”, [Microsoft.TeamFoundation.VersionControl.Client.VersionSpec]::Latest);


It works for all xaml builds and also for the new build system.

New Visual Studio Alm Ranger

Hello guys, now I’m here to announce that now I’m part of Visual Studio Alm Ranger team!

Alm Ranger team is a virtual team coordinated mainly by Microsoft employees, and develop some processes about VS Alm world.

My first project will be the Build Customization Guide, and it’s about to start. Hope to write soon more about it.