简体   繁体   English

如何通过从另一个分支复制本地内容从 TFS 中的新分支中提取

[英]How to pull from a new branch in TFS by copying local contents from another branch

There are two branches in the TFS repo. TFS 存储库中有两个分支。 Branch 1 and Branch 2. Branch 2 was created recently and I want to pull contents of branch 2. I have pulled branch 1 in my machine.分支 1 和分支 2。分支 2 是最近创建的,我想提取分支 2 的内容。我已经在我的机器中提取了分支 1。 As there is limited bandwidth, I was wondering is there any way to copy the contents from branch 1 folder into branch 2 folder in my local machine so that I won't have to utilize much of my mobile data.由于带宽有限,我想知道是否有任何方法可以将分支 1 文件夹中的内容复制到本地计算机的分支 2 文件夹中,这样我就不必使用大量移动数据了。 I tried it but source control explorer in visual studio is not detecting the files I copied to branch 2 folder from branch 1.我试过了,但 Visual Studio 中的源代码管理资源管理器没有检测到我从分支 1 复制到分支 2 文件夹的文件。

Is there any tricks to make it work?有什么技巧可以让它发挥作用吗?

Update:更新:

Since you use TFVC, you need to make sure the folder you try to copy to has been mapped to Branch 2. And you should be able to see the copy files detected in Excluded Changes after you copy the files in the mapped folder.由于您使用 TFVC,因此您需要确保您尝试复制到的文件夹已映射到分支 2。并且您应该能够在复制映射文件夹中的文件后看到在排除的更改中检测到的复制文件。

When you connect to TFS again, you need to perform “Get Latest” for the Branch 2. If you modify files in the mapped folder, you would get conflicts when you perform "get latest", choose keep local version, and then the modified files will show in Included Changes, you just need to check them in.再次连接TFS时,需要对Branch 2执行“获取最新”。如果修改映射文件夹中的文件,执行“获取最新”时会出现冲突,选择保留本地版本,然后修改文件将显示在包含的更改中,您只需签入它们。


TFS provide two models of version control: Git and Team Foundation Version Control (TFVC). TFS 提供两种版本控制模型:Git 和 Team Foundation 版本控制(TFVC)。

Git is a distributed version control system. Git是一个分布式版本控制系统。 Each developer has a copy of the source repository on their dev machine.每个开发人员在他们的开发机器上都有一个源存储库的副本。 Developers can commit each set of changes on their dev machine and perform version control operations such as history and compare without a network connection.开发人员可以在他们的开发机器上提交每组更改并执行版本控制操作,例如历史记录和比较,而无需网络连接。 Branches are lightweight.树枝很轻。 When you need to switch contexts, you can create a private local branch.当您需要切换上下文时,您可以创建一个私有本地分支。

Team Foundation Version Control (TFVC) is a centralized version control system. Team Foundation 版本控制 (TFVC) 是一个集中的版本控制系统。 Typically, team members have only one version of each file on their dev machines.通常,团队成员在他们的开发机器上只有一个版本的每个文件。 Historical data is maintained only on the server.历史数据仅在服务器上维护。 Branches are path-based and created on the server.分支是基于路径的并在服务器上创建。

If you use Git version control, you can create a private local branch and push the commits later.如果您使用 Git 版本控制,您可以创建一个私有本地分支并稍后推送提交。 If you use TFVC version control, you would see the copy files detected in Excluded Changes after you copy the files in the local path of the branch.如果您使用 TFVC 版本控制,则在复制分支的本地路径中的文件后,您会看到在排除的更改中检测到的复制文件。 You can promote the changes as new files, which will cause conflicts when you check in.您可以将更改提升为新文件,这会在您签入时导致冲突。

For your scenario, Git version control will be more suitable for you.对于你的场景,Git版本控制会更适合你。 If you use TFVC, you can migrate them to Git repos:如果您使用 TFVC,您可以将它们迁移到 Git 存储库:

https://docs.microsoft.com/en-us/azure/devops/repos/git/import-from-tfvc?view=azure-devops https://docs.microsoft.com/en-us/azure/devops/repos/git/import-from-tfvc?view=azure-devops

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM