如何在一个git仓库中管理两个TFS项目? [英] How to manage two TFS projects in one git repository?
问题描述
我们使用TFS作为主要的源代码控制,我希望将git作为前端与 git-tfs rcheckin 命令,但我有问题导入我的仓库到git。 我在我的TFS中有两个项目 我想在一个git仓库中管理它们。 如何将这两个文件克隆到一个git存储库中,以便我可以将更改作为一个TFS提交并推送到两个项目中changeset? 我尝试使用 git tfs子树,但不知何故我无法弄清楚这个工作流程。我的方法是像下面显示的那样初始化git repo,但是我收到了无法恢复的错误: 如果您在TFS上使用Git: 最简单的方法是简单地检出每个项目并将这些文件添加到单个Git存储库中。 如果您在TFS上使用TFVC: 没有办法做到这一点。您可以分别克隆每个回购并独立处理它们。您无法在单个Git仓库中拥有两种不同的分支结构。 如果您在没有分支的情况下使用TFVC: 您可以使用GitTF子树功能来创建一个包含TFVC的两个独立同步文件夹的Git回购。 我建议您永久迁移到Git。 / p> We are using TFS as main source control and I would like to use git as a "frontend" together with git-tfs rcheckin command but I have problems importing my repositories into git. I have a two projects in my TFS and I would like to manage them in one git repository. How I can clone those two into one git repository so I can commit and push changes to both projects as one TFS changeset? I tried using git tfs subtree but somehow I cannot figure out workflow with this. My approach was to init git repo like shown below but I got errors I cannot recover from:
If you are using Git on TFS: The easiest way to do this is to simply check out each project and add the files to a single Git repository. If you are using TFVC on TFS: There is no way to do this. You can clone each repo separately and work on them independently. You cant have two different branching structures in a single Git repo. If you are using TFVC with no branches: You can use the GitTF subtree feature to have a single Git repo that contains two independent synched folders from TFVC. I would recommend that you migrate permanently to Git. 这篇关于如何在一个git仓库中管理两个TFS项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
$ / ProjectA
$ / ProjectB
> git init
在c:/somedir/.git/
>中初始化了空的Git仓库。 git tfs subtree add --prefix = ProjectA http:// tfs_server:8080 / tfs / $ / ProjectA
执行子树添加
- >新拥有远程默认
- >新的远程default_subtree / ProjectA
从TFS远程'default_subtree / ProjectA'中获取...
C3779 = 7e532464ef6120ac0b19aa3c7651ceae915dc366
C3780 = 16f4636fc53d729767f65213ed047c11d1a707ee
致命:模棱两可的参数'HEAD':未知版本或路径不在工作树中。
使用' - '分隔修订版本的路径,如下所示:
'git< command> [< revision> ...] - [< file> ...]'
运行命令错误:git subtree add --prefix = ProjectA-m从提交'16f4636fc53d729767f65213ed047c11d1a707ee'添加'ProjectA /
git-tfs-id:[http:// tfs_server:8080 / tfs /]; C3780refs / remotes / tfs / default_subtree / ProjectA
退出错误代码:1
$/ProjectA
$/ProjectB
> git init
Initialized empty Git repository in c:/somedir/.git/
> git tfs subtree add --prefix=ProjectA http://tfs_server:8080/tfs/ $/ProjectA
executing subtree add
-> new owning remote default
-> new remote default_subtree/ProjectA
Fetching from TFS remote 'default_subtree/ProjectA'...
C3779 = 7e532464ef6120ac0b19aa3c7651ceae915dc366
C3780 = 16f4636fc53d729767f65213ed047c11d1a707ee
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
error running command: git subtree add --prefix=ProjectA "-m Add 'ProjectA/' from commit '16f4636fc53d729767f65213ed047c11d1a707ee'
git-tfs-id: [http://tfs_server:8080/tfs/];C3780" refs/remotes/tfs/default_subtree/ProjectA
Command exited with error code: 1