如何在 Visual Studio 中将项目从 Git 移动到 TFS

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25826465/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 02:27:49  来源:igfitidea点击:

How to move a project from Git to TFS in Visual Studio

gitvisual-studiotfstfvc

提问by user2900166

I have a project that I've been working on for some time now and I just cannot make Git work for me. I've spent a day trying to recover lost code and I am done with Git.

我有一个项目,我已经工作了一段时间,但我无法让 Git 对我来说有效。我花了一天时间试图恢复丢失的代码,我已经完成了 Git。

Can anyone tell me how to move an existing project into TFVC? I have a Visual Studio Online account with a TFVC project all set up for this task, but I cannot figure out how to change the source control settings so that the project is no longer tied to Git.

谁能告诉我如何将现有项目转移到 TFVC 中?我有一个 Visual Studio Online 帐户,其中有一个 TFVC 项目,全部为此任务设置,但我不知道如何更改源代码控制设置,以便项目不再与 Git 绑定。

I am currently developing on VS 2013.

我目前正在 VS 2013 上进行开发。

Any help is greatly appreciated!

任何帮助是极大的赞赏!

回答by Horizon_Net

Just delete the .gitfolder (this one is normally hidden) in the root folder (f.e. via Windows Explorer). This deletes all things related to git. After that add the code to your TFS project and check it in into TFS.

只需删除根文件夹中的.git文件夹(这个文件夹通常是隐藏的)(通过 Windows 资源管理器)。这将删除与 git 相关的所有内容。之后,将代码添加到您的 TFS 项目并将其签入 TFS。

回答by Some_Yahoo

Here's the procedure.

这是程序。

  1. Right click the project name in solution explorer.
  2. Open Folder in File Explorer.
  3. Close Visual Studio.
  4. Delete the folder and files that have .git in the name.
  5. Open Visual Studio and load the project.
  6. Tools->Options->Source Control.
  7. Pick TFS.
  8. Go to Team Explorer tab.
  9. Connectto your TFS server (I assume you have already created a repo)
  10. Pick the right repo.
  11. Right click solution in solution explorer Add to Source Control.
  1. 右键单击解决方案资源管理器中的项目名称。
  2. 在文件资源管理器中打开文件夹。
  3. 关闭 Visual Studio。
  4. 删除名称中包含 .git 的文件夹和文件。
  5. 打开 Visual Studio 并加载项目。
  6. 工具->选项->源代码管理。
  7. 选择 TFS。
  8. 转到团队资源管理器选项卡。
  9. 连接到您的 TFS 服务器(我假设您已经创建了一个存储库)
  10. 选择正确的回购。
  11. 在解决方案资源管理器中右键单击解决方案添加到源代码管理。

回答by MrHinsh - Martin Hinshelwood

You cant just change from Git to TFVC as this option is bound to the Team Project. You will need to create a new Team Project making sure that you select TFVC as the provider.

您不能只是从 Git 更改为 TFVC,因为此选项绑定到团队项目。您需要创建一个新的团队项目,确保选择 TFVC 作为提供者。

  1. Connect to that new Team Project and create a local workspace.
  2. Create the folder structure you need. I would recommend $/newTP/MyPeoduct/Rx.x/
  3. Copy the files from the Git repo (except .git) to this location.
  4. Open the solution and right click on it and select "add to source control"
  1. 连接到那个新的团队项目并创建一个本地工作区。
  2. 创建您需要的文件夹结构。我会推荐 $/newTP/MyPeoduct/Rx.x/
  3. 将文件从 Git 存储库(.git 除外)复制到此位置。
  4. 打开解决方案并右键单击它并选择“添加到源代码管理”

You should now be migrated...

你现在应该被迁移...

回答by JR Berg

VS2017 - I had the same issue listed above and after deleting the .git folder in the root directory of my project folder, clicking Add Project to Source Control only created a new .git, from both Solution Explorer and the File menu. I got mine to work by deleting the .git folder, going into Team and Manage Connections and opening the TFS Project I wanted to add it to. I then went to File->Source Control->Add Solution to Source Control and it worked.

VS2017 - 我遇到了上面列出的相同问题,在删除项目文件夹根目录中的 .git 文件夹后,单击“将项目添加到源代码管理”仅从解决方案资源管理器和文件菜单中创建了一个新的 .git。我通过删除 .git 文件夹,进入 Team 和 Manage Connections 并打开我想要将其添加到的 TFS 项目来让我的工作。然后我转到文件-> 源代码管理-> 将解决方案添加到源代码管理并且它起作用了。