J.Merrill
J.Merrill

Reputation: 1253

Using both local Git and (remote) TFS with Visual Studio 2013

I started work on some code locally and used Git (Git Gui and command-line) to manage it. I've now been asked to put the project into TFS "at corporate". I can access TFS remotely using a VPN connection.

The code is, to VS, a single solution with multiple projects. I successfully added the solution to TFS using VS, and it seemed to find all the projects and add their .csproj files and all the code to TFS source control.

Later, when not connected to TFS (VPN off), I made a simple change and committed it to my local Git repository. I have had nothing but frustration attempting to (connect to the VPN and) try to commit the change to TFS.

So far so good.

And I'm right back where I started, except that it says "Connect | {solutionName} (Local)"!

Opening the solution first doesn't help; when I connect to TFS the solution gets closed. Closing and opening VS just has it start in "VS knows about TFS, but you're offline" mode and opening the solution with TFS active makes it switch to the Git provider in (Local) mode.

I am very close to doing the registry hacks to disable the Microsoft Git Provider -- I've done my Git work using Git Gui and the commandline; VS has not been involved.

Am I crazy? I would have thought that "develop locally using Git, connect to TFS to sync with others" was a mainstream use case for VS.

Any assistance would be appreciated. Thanks.

Upvotes: 8

Views: 3704

Answers (3)

MKesper
MKesper

Reputation: 519

I switched to using mercurial for my local repository. This features no VS integration (needs external committing) but also no VS trouble.

Upvotes: 0

blalond
blalond

Reputation: 885

Visual Studio only sees git repositories if the .git folder is used as the store for the git repository. So, we can fake-out VS by using a different folder for the git store.

  • Rename the current .git folder to _git (.git dir may be hidden)
  • Create a text file in that same folder called .git containing just the line gitdir: _git (make the file via command line: echo gitdir: _git>.git)
  • Add _git to your .gitignore file

Now when you launch VS it will not see that git repository and will use TFS instead.

Upvotes: 9

If the server is configured for TFVC and you have a local Git repo then you cant just push from local to tfs. You have two options. You can:

1) You can create a new team project that is configured for Git and push as normal.

2) you can use TF-Git to push from your local git repo to the TFVC server: http://www.microsoft.com/en-gb/download/details.aspx?id=30474

Upvotes: 3

Related Questions