Peter Schneider
Peter Schneider

Reputation: 1701

Use git-tfs with multiple Git-users

The official SCM here at work is TFS. I use git-tfs to be able to work. Other devs here at the local branch of our company use StarTeam for local development branches (yes, there are SCMs out there worse than TFS). Now, some of us thinking about migrating from StarTeam to Git for our local development.

What is the best way to use git in combination with tfs for multiple users?

The best idea I had:

  1. One central server holds a 1:1 copy of the TFS repository (via git-tfs, synced per script every hour or so)
  2. Dev pull from this server .
  3. Dev creates branch to implement feature.
  4. When done, dev commits via TFS and deletes branch.
  5. Dev pulls his changes via step one into his master branch.

Might this workflow work? Does anyone have experience how something like that can be set up?

Upvotes: 0

Views: 221

Answers (2)

Peter Schneider
Peter Schneider

Reputation: 1701

The current solution is basically the same as I outlined above. The main restrictions:

  • My collegues are not used to console and try to avoid them as much as possible. CLI-applications are a no go (sadly)
  • TFS is still "upstream" (it's not a build process I want to keep alive)
  • The history have to be correct (who commited what and when)
  • Every developer have to be able to commit every time

So... :

  • The main repository is synced every 10 minutes by git tfs fetch and the branches are reset to tfs/branchname
  • Commits into the official branches (copies of the tfs-branches) are forbidden.
  • Checkins into TFS are done by git tfs rcheckin --no-merge (wrapped in a plugin for GitExtensions).
  • :%s/tfs/TFVC/g

We are running this setup for some months now for 3 repositories and multiple branches. My colleagues get used to git and this workflow within a short time - a question every now and then but it becomes less and less. I'm moderatly surprised, how well this had worked out.

Upvotes: 0

First TFS is not an SCM, it is an ALM platform. It provides two native SCM options, TFVC and Git.

Your best bet would be to create a new Team Project in your TFS server and when you are asked which SCM provider to use pick Git. This will give you something similar to GitHub or Bitbucket but enterprise ready with enterprise audit. You can then add this new TFS Git repo as an origin and push.

If you still have to use TFVC then I would suggest that in addition to the above you can push daily with Git-tfs between this server Git repo and TFVC.

  1. Create a MyProject-Git Team Project with Git as the SCM
  2. Clone your MyProject-TFVC with Git-TF
  3. Add MyProject-Git as an remote for your local Git copy of MyProject-TFVC
  4. Push to MyProject-Git

You now have both a Git and TFVC copy of the same code with all of the history intact. Each of your coders can then clone the MyProject-Git and work happily away in Git.

You can then setup an automated and scheduled process to sync MyProject-Git and MyProject-TFVC on a regular cadence. All you need notification of is conflicts, but as everything is server side and backed up you can do that at your leisure.

Upvotes: 1

Related Questions