git-tfs 本地 Git 回购到 TFVC

git-tfs local Git repo to TFVC

我正在使用本地 TFS 实例测试 git-tfs(它也适用于 VSO 吗?)并尝试使用 rcheckin 推送我的 Git 提交给 TFVC。但是,当我尝试使用 rcheckin 时,我收到一条错误消息,指出未找到 TFS 父项。我要推送到的 TFVC 存储库是空的,我想将我的更改从 Git 推送到 TFVC。这是我所做的:

C:\git add remote tfs http://localhost:8080/tfs/DefaultCollection/TeamProject
C:\git tfs rcheckin -master
Working with tfs remote: default
No TFS parents found!

我错过了什么?我是否对我的其他分支(如 feature1、feature2 等)执行 运行 此命令?我是 Git-TFS 的新手,但它似乎是一个非常方便的工具。

免责声明:我是 git-tfs 的开发者之一...

does it work with VSO, too?

是的!

What am I missing?

在能够使用 git-tfs(并使用 rcheckin 命令)之前,您必须 clone 您的 tfs 存储库。

也请随意阅读其他文档。 使用 rcheckin 是个好主意 ;-)

How do I use an existing Git repo (separate) to push changes to the TFS repo? I've cloned the TFS repo, and it looks like it goes into a separate folder with it's own .git folder

Git-tfs 不打算这样做。但是使用 rebase.

存在一个(困难的!)解决方案
  1. 在从 TFS 克隆的新存储库中将现有存储库添加为远程存储库并获取
  2. 使用 git rebase --into 将您现有的旧提交变基为从 tfs 获取的提交
  3. 使用rcheckin 推送提交
  4. 如果你有分支,请一次又一次地这样做(有更多的细节。我希望你没有!!!)

编辑:我有 written a shell script 来替换前 2 个步骤并使其更容易和更快。