Background

Whilst at the Microsoft MVP summit there are a number of MVP2MVP sessions, these are similar to DDD style sessions with MVPs presenting as opposed to Microsoft staff. One I found really interesting was one by Richard Banks based on his post on using GIT with TFS. Now this was a usage of source control tools I had not considered, a mixture of Git and TFS (or could be Git to SVN, similar tools are available)

Why do you want this usage? Especially with local workspaces coming in TFS11?

The simple answer is it allows a developer to have the advantage of Git’s multiple local versions of a given file, that they can branch, merge and rollback to as required. All prior to pushing all the changes up to a central TFS server (as opposed to GitHub or a company central Git repository).

OK lets face it this is an edge case, and it is not helped by the usage being command line driven, as opposed to be integrated with the IDE (real developers don’t use a UI or mouse, so that is OK – right?). So to try to make life a it easier I would suggest also installing Posh Git.

Setup

So what is required to get this running, if you like me a fairly new to Git there are a couple of gotcha’s. Here is the process I followed

I used Chocolaty (think Nuget for applications) to install tfsgit, this handles the dependency for the Git client

cinst tfsgit

Next I install poshgit

cinst poshgit

It is essential that you edit your Windows PATH environment variable to point to both the Git and the TFSGit folders as this is how Git picks up the extra Tfs commands, it should be something similar too this

PATH= $PATH;C:Program Files (x86)Gitcmd;C:toolsgittfs

Finally for poshgit  you need runs its install script (in a PowerShell windows with elevated privileges), so it can report the number of file changes in the command prompt (note the prompt only changes when you are in a Git folder)

c:toolspostgit..some versioninstall.ps1

So hopefully this will get you going, so you can try this interesting edge case.

For more general chat on Git and distributed source control try this recent Herding Code podcast