I have a repository that is managed by tfs. However locally I would like to manage it via git and the push changes to tfs. Once I'm creating git repo over there VS2013 in team explorer shows this solution managed by git only. If I try to edit any file it complains that file is read only only I cannot save it in a previous version. So my question is there any way for Visual Studio 2013 to forget about git at all and manage it as tfs repository. I can manage git from command line. Or is there a way to make it to checkout files from tfs repo when I'm doing a changes?
In order to disable/disconnect your repository associated with your data factory, first select master branch (main) under Git branch settings. Then you need to go to Git Configuration tab under Manage and use Disconnect button to remove the Git repository association as shown in the below GIF.
In the Project Explorer, select the file to remove. If you select a folder, project, or solution, any eligible child items will also be removed. choose Source Control > Remove or press Ctrl+R, R.
Visual Studio GitFrom the Git menu, choose Git > Settings and then select the Git Global Settings view. That view contains the name and email settings for the current user. Or, choose Git Repository Settings > General to edit the name and email settings for the current Visual Studio project repo.
The solution outlined here works well for me: How can you disable Git integration in Visual Studio 2013 permanently?
Essentially:
Visual Studio will now only use TFS and git works properly as well.
For your scenario Git-tf
is probably a better solution, it will create a local git repo based on your TFVC source control folder. When you're done, you can push your changes from Git directly to TFVC from the commandline. Since you're already comfortable on the commandline, that might work out pretty well for you.
It's very hard to force Visual Studio to currently stay on Team Foundation Source Control when there is a git repo in the same folder.
As a horrible workaround, close your solution, rename the .git
folder to _git
and reload the solution. This should bring TFVC back, but if it doesn't, then rebind the solution to TFVC if using file->source control->advanced->Change Source Control. Then after checking in, close the solution again, rename _git
back to .git
and reload.
As Ed mentions in the comments, you can move your .git folder to another folder, like this:
\MyProjects
\GitRoot
| \.git
\MySolution
\MyFirstProject
\MySecondProject
This allows Visual Studio to use the TFVC bindings and you can tell the git commandline that the .git directory is elsewhere using the git --git-dir=\MyProjects\GitRoot\.git
command argument.
You can set an environment variable named GIT_DIR
to fix that in one go, as @hlovdal mentions.
And there is another trick that @Eric mentions which creates a text file names .git
that has the following in it:
gitdir: _git
Rename .git folder to _git, then make sure you add _git
to .gitignore
Tip: to create a file that starts with a .
from Windows Explorer you can use the New/Text Document option:
Then name the file .git.
(make sure the Show file Extensions option is ticked):
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With