简体   繁体   English

带有单独存储库的 git-tf

[英]git-tf with separate repositories

I'm part of an organization that is unfortunately using TFS/TFVC for source control.我所在的组织不幸使用 TFS/TFVC 进行源代码控制。 My small team been tasked with doing a sort of "proof of concept" run with git, but we have to be able to push our changes into TFS.我的小团队的任务是使用 git 进行某种“概念验证”,但我们必须能够将我们的更改推送到 TFS。 Luckily, git-tf and git-tfs exist.幸运的是,存在 git-tf 和 git-tfs。 However, our TFS repository is one monolithic repository with 20+ different projects/applications.但是,我们的 TFS 存储库是一个包含 20 多个不同项目/应用程序的整体存储库。 The proper way to do this in git would be for each project to be its own git repository.在 git 中执行此操作的正确方法是让每个项目成为它自己的 git 存储库。 I know that I can check out an individual project from TFS using the bridges with git-tf, and if we were permanently converting to git, it's what I would do.我知道我可以使用带有 git-tf 的桥接器从 TFS 中查看单个项目,如果我们永久转换为 git,这就是我会做的。

What I'm concerned about is if we still need to push back to TFVC, if I check out each project as its own git repository, will TFVC become confused when we push the changes back as each project is changed independently?我担心的是,如果我们仍然需要推回 TFVC,如果我将每个项目都检出为自己的 git 存储库,那么当我们将更改推回时,TFVC 会因为每个项目独立更改而变得混乱吗? That is, if I check out Project A from changeset 123 and Project B also from 123, make changes in A and then push those back up to TFVC as changeset 124, will TFVC think there's a merge conflict or other issue when we later make changes to B and push them up since it's all one big repository under TFVC.也就是说,如果我从变更集 123 中检出项目 A,也从 123 中检出项目 B,在 A 中进行更改,然后将它们作为变更集 124 推送回 TFVC,当我们稍后进行更改时,TFVC 会认为存在合并冲突或其他问题吗?到 B 并推送它们,因为它是 TFVC 下的一个大存储库。

Does either git-tf or git-tfs handle this properly? git-tf 或 git-tfs 是否正确处理了这个问题? Or do I need to just check the whole TFS repository out as a single git repository and work with that as is?或者我是否需要将整个 TFS 存储库作为单个 git 存储库检出并按原样使用? Or in this case would it maybe be better to check out the various TFS projects into a single local workspace, and use git to create repositories without using the git-tf bridge, and check changes back into TFS as if they were edits made in the workspace directly (basically ignoring all the git history and commit logs and just using it for local change tracking)?或者在这种情况下,最好将各种 TFS 项目检出到单个本地工作区中,并使用 git 创建存储库而不使用 git-tf 桥,并将更改检回 TFS,就好像它们是在工作区(基本上忽略所有 git 历史记录和提交日志,仅将其用于本地更改跟踪)?

Yes, you can create multiple Git Repositories per TFS Team Project.是的,您可以为每个 TFS 团队项目创建多个 Git 存储库。 This is just the same as in one Team Project to rule Many Git Repositories.这与在一个团队项目中统治多个 Git 存储库相同。

在此处输入图片说明

More details you can take a look at this link: Many Git Repositories, but one Team Project to rule them all您可以查看此链接的更多详细信息: 许多 Git 存储库,但一个团队项目来统治它们

If I check out Project A from changeset 123 and Project B also from 123, make changes in A and then push those back up to TFS as changeset 124, will TFS think there's a merge conflict or other issue when we later make changes to B and push them up since it's all one big repository on TFS.如果我从变更集 123 中检出项目 A 和从 123 中检出项目 B,在 A 中进行更改,然后将它们作为变更集 124 推送回 TFS,当我们稍后对 B 进行更改时,TFS 会认为存在合并冲突或其他问题吗?将它们推高,因为它们都是 TFS 上的一个大存储库。

TFS will only detect the corresponding files and codes, just as jessehouwing commented.正如jessehouwing评论的那样,TFS只会检测相应的文件和代码。 you'll only get conflicts when files have been changed in both git repositories.只有当两个 git 存储库中的文件都已更改时,您才会遇到冲突。 Such as a file in changeset 123 have version a, and edited in changeset 124 with version b from git rep1.例如,变更集 123 中的文件具有版本 a,并在变更集 124 中使用来自 git rep1 的版本 b 进行编辑。 And this file also check out with version a for repB.并且此文件还检查了 repB 的版本 a。 If you didn't change it to version b in git rep2.如果您没有在 git rep2 中将其更改为版本 b。 When you push changes you will certainly get the conflict.当您推送更改时,您肯定会遇到冲突。


Update更新

git-tfs is a two-way bridge between TFS and git. git-tfs是 TFS 和 git 之间的双向桥梁。 Such as using git tfs checkintool command to commit through the tfs checkin window.比如使用git tfs checkintool命令通过 tfs checkin 窗口提交。 So the result is the same as using multiple git repositories in one GIT team project.因此结果与在一个 GIT 团队项目中使用多个 git 存储库相同。 The only difference is one push commits, another check in changes.唯一的区别是一次推送提交,另一次检查更改。 All of three methods you have mentioned above should be work.您上面提到的所有三种方法都应该有效。 The best one is using git-tfs which will tracking all history.最好的方法是使用 git-tfs 来跟踪所有历史记录。

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

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