简体   繁体   English

git-tfs 本地 Git 仓库到 TFVC

[英]git-tfs local Git repo to TFVC

I'm testing out git-tfs with an on-premises TFS instance (does it work with VSO, too?) and trying to use rcheckin to push my Git commits up to TFVC.我正在使用本地 TFS 实例测试 git-tfs(它是否也适用于 VSO?)并尝试使用rcheckin将我的 Git 提交推送到 TFVC。 However, when I try and use rcheckin , I get an error that no TFS parents are found.但是,当我尝试使用rcheckin ,我收到一条错误消息,即未找到 TFS 父项。 The TFVC repo I'm pushing to is empty, and I want to push my changes from Git to TFVC.我推送到的 TFVC 存储库是空的,我想将我的更改从 Git 推送到 TFVC。 Here's what I've done:这是我所做的:

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!

What am I missing?我错过了什么? Do I run this command for my other branches (like feature1, feature2, etc.)?我是否为我的其他分支(如 feature1、feature2 等)运行此命令? I'm pretty new to Git-TFS, but it seems like a very handy tool.我对 Git-TFS 很陌生,但它似乎是一个非常方便的工具。

Disclaimer : I'm one of the developer of git-tfs...免责声明:我是 git-tfs 的开发人员之一...

does it work with VSO, too?它也适用于 VSO 吗?

Yes!是的!

What am I missing?我错过了什么?

Before being able to work with git-tfs (and use the rcheckin command), you MUST clone your tfs repository.在能够使用 git-tfs(并使用rcheckin命令)之前,您必须克隆您的 tfs 存储库。

Feel free to read the other docs, too.也可以随意阅读其他文档。 The use of rcheckin is a good idea ;-)使用 rcheckin 是个好主意 ;-)

How do I use an existing Git repo (separate) to push changes to the TFS repo?如何使用现有的 Git 存储库(单独的)将更改推送到 TFS 存储库? I've cloned the TFS repo, and it looks like it goes into a separate folder with it's own .git folder我已经克隆了 TFS 存储库,看起来它进入了一个单独的文件夹,里面有自己的 .git 文件夹

Git-tfs is not intended to do that. Git-tfs 不打算这样做。 But a (difficult!) solution exists using rebase .但是使用rebase存在一个(困难!)解决方案。

  1. Add your existing repo as remote in the new repo cloned from TFS and fetch在从 TFS 克隆的新存储库中添加您现有的存储库作为远程存储并获取
  2. Use git rebase --into to rebase your old existing commits into the one fetched from tfs使用git rebase --into将旧的现有提交重新设置为从 tfs 获取的提交
  3. Use rcheckin to push the commits使用rcheckin推送提交
  4. Do that again and again if you have branches (with more subtilities. I hope you have not!!!)如果你有分支(有更多的细节。我希望你没有!!!)

edit: I have written a shell script to replace the first 2 steps and make it easier and quicker.编辑:我编写了一个 shell 脚本来替换前两个步骤,使其更容易、更快捷。

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

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