Monday, February 16, 2015

How TFS and git can play together

Playing around with Git for some days now, I see the following benefits over centralized systems (ordered by importance):
  • quick context switches between branches and quick setup of new branches
  • faster, due to fewer network traffic
  • using state-of-the-art technology, e.g. consistent style of working with open source community
  • no need to be online
  • inherent decentralized backup of repositories
  • 2-way commit (i.e. staging area) gives more fine-grained control about what to check in
TFS and git are playing together out-of-the-box since Version 2013 of Visual Studio / Team Foundation Server (let's call this TFS-git), but the problem in projects that are using TFS as a central repository (Team Foundation Version Control ("TFVC")) is that making a hard switch to TFS-git at a certain point of time will most probably be too risky in enterprise scenarios. It makes more sense to start small and first gain some experienc with DVCS to see if it fits your needs - how can this be achieved?
The solution is a hybrid way: installing git-tfs (a two way bridge between git and tfs, the platform neutral alternative is Microsofts git-tf) makes it possible to work with git locally while the remote repository stays TFVC, i.e. every developer on the project is free to decide to choose between working with the bridge or using TFS "traditionally".

To be complete, let me mention a 3rd option: there may be situations where the only need for TFS functionality is the usage of TFS build processes (i.e. no work item management and other TFS functionality). For these scenarios, it is possible to use Visual Studio and git without TFVC, hosting the "central" repository e.g. at github.

The following table contains the support of the features work item management, build process usage and gated checkin in relation to the mentioned possibilities how TFS and git can play together:

work item mgmt. build process usage gated checkin
TFS-git yes yes no
git-tfs (locally git, remote TFVC) yes yes no
git with any non-TFVC (e.g. github) no yes no