I created a tool called git-tfs. I alluded to it the other day. I’ve been using it for about a month on a solo project, and a few other people are picking it up.

As of a few days ago, I released its source code. (I plan to move the ‘official’ mainline to my company’s fork, eventually.) As of today, there’s a pre-built binary that I’ve called v0.9.

To install, you first need git (e.g. msysgit). Download git-tfs and add the extracted directory to your path (or somewhere else that git can find it).

To use, you need to clone your TFS repository. Then you use git like normal, and occasionally fetch of shelve to synchronize with TFS. I’m pretty comfortable with fetching from TFS. I plan to add more ways to push data into TFS.

For cloning: git tfs clone http://tfs:8080 $/MyProject/MyDir my_git_clone

Clone is the same as init + fetch. git-tfs’s clone and init are happy to add itself to an existing git repository or to create a new one for you.

To shelve: git tfs shelve “Shelveset name”

I opted for shelving first for a few reasons. First of all, it’s pretty safe: there are no permanent changes made to the TFS repository. Also, it sidesteps a couple of tricky issues, including: work item association and source control policy validation on the TFS side; and history preservation vs. rewriting on the git side. I would like to have a way to replicate git commits back into TFS, but that’s not done yet.