Is it possible to mix TFS and GIT Extensions/TortoiseGit in the same solution?

924 views Asked by At

I'm using Visual Studio 2013 Pro - For reasons beyond my control, we are stuck using TFS as primary source control system, I wonder - is it possible to use TFS and one of other Source Control Providers like this:

  1. Get latest "DEV" from TFS
  2. Somehow change Source control provider for solution in Visual Studio to one of Git SCPs
  3. Make branches for your changes, basically work locally on Git
  4. When check-in TFS is necessary, switch back to TFS SCP and commit changes, then get back to Git SCP

Unfortunately when I simply try to switch I get the following message:

"The active solution or project is controlled by a different source control plug-in than the one you have selected. If you change the source control plugin, the active solution or project will be closed. Do you wish to continue?"

I tried "cheating" Visual Studio by manually creating git repository (by manually - I mean from Windows Explorer), and commiting changes that way - unfortunately, Visual is smart (or rather stupid) enough to detect .git directory, and switch automatically to Git SCP - without option to return to TFS (unless you want to re-add project to TFS every time you switch...).

Does anybody know how to work with TFS and Git in the same solution?

1

There are 1 answers

0
Syntony On

Have a look at Git-tfs (for windows only). If working with Mac-OS search for Git-tf.

A solution could be to move out the .git folder to an external folder and point the git directory to the actual source code Folder as described by Tiago Salgado

So an example is:
D:\Git\ (where I have my different .git repositories per project stored)

-- D:\Git\ProjectOne\.git 
-- D:\Git\ProjectTwo\.git 

D:\Code (where I have all projects source code)

-- D:\Code\ProjectOne\.git (this is a file, not a folder anymore) 
-- D:\Code\ProjectTwo\.git (this is a file, not a folder anymore) 

So, this .git file has to be generated as:

$ echo "gitdir: /git/ProjectOne/.git" > .git

After doing this, you can open Visual Studio and TFS will be selected by default. You still be able to run a “git status” or any git command as you always did before.