Git and tfs: can I have only the central repo communicate with tfs?

437 views Asked by At

I'd like to move my team from using TFS for version control, to git.

Is there any reason I shouldn't do the following:

  1. Create a central git repository using git-tfs
  2. Have each developer clone the central repo, pull from, and push to it
  3. And then only update tfs from the central repo?

Thanks!

3

There are 3 answers

2
VonC On

Create a central git repository using git-tfs

The can be dangerous, as TFS has a central repository with everything in it.
The resulting git repo can end up being a huge one (not easy to clone around)

I would recommend making several git-tfs in order to create several smaller Git repos.

0
jessehouwing On

Team Foundation Server 2013 now supports Git as source control repository for a Team Project and the Visual Studio Tools for Git provide Git access embedded in Visual Studio (add-in for 2012, ships in the box with 2013).

0
Philippe On

Due to the fact that the interaction in Git and TFS, git-tfs, is not perfect (due to the fact that a main caracteristic of Git is that you can't modifiy a commit once created and that git-tfs doesn't work with bare repositories), putting a central Git repository in front of TFS is not straight forward...

I imagine all your team will use this worflow otherwise, you could stop thinking to the idea to do this (due to merge conflict you will have to manage)...

Because git-tfs doesn't work with a bare repository, you will end up with, in fact 2 git repositories that you should sync. The 1st one where you push ( a bare one) and the 2nd which interact with TFS (not bare where you use git-tfs).

Then, you've got 2 options : a) you accept to have only one commit on TFS even if you have multiple git commit (use git-tfs 'checkin' command) b) you want to replicate each git commit in TFS (use git-tfs 'rcheckin' commit)

The first case a) is not the better but is the easier to solve with some scipts and git hooks because there is only always new git commit to sync between the 2 repositories.

The 2nd case b) is, for me, the only acceptable but is much more harder to solve because when you sync git repository with git-tfs 'rcheckin' command, for each git commit, a new one is created and the sync script will be much harder to write (I don't even know if all the merge conflict could be resolved). I begun to do write these script but stoped because it doesn't worth the effort (especially now that Visual Studio 2012 resolve the reload problem where every time the solution files was reloaded). If you want to do that, the scripts in the post below are a good step from where to begin...

In conclusion, I think it doesn't worth the work to do that. You could find a local workflow with git-tfs which is quite easy and don't need a git central repository...

But if you still want to have a Git central repository, you could check this post ( http://sparethought.wordpress.com/2012/08/23/my-environment-for-day-to-day-work-with-git-tfs/ ) of an hybrid way (commit to TFS and fetch from git) that seems works.