简体   繁体   English

git-tfs从git开始

[英]git-tfs starting from git

I have an existing git repo that I am being forced to put in tfs. 我有一个现有的git repo,我被迫放入tfs。 I would like to use the git-tfs tool, but can't figure out for the life of me how to do this. 我想使用git-tfs工具,但无法弄清楚我的生活如何做到这一点。 All of the examples I have seen start with git tfs clone, but I already have a git repo and would like to run "checkin" on it. 我见过的所有例子都是从git tfs clone开始的,但我已经有了一个git repo,并想在其上运行“checkin”。

EDIT: I have tried cobbling together instructions based on the opposite scenario that I need. 编辑:我已经尝试根据我需要的相反方案拼凑指令。 I have tried creating an empty project and adding that to tfs, then copy my code from git, but I lose my history (which I don't want). 我尝试创建一个空项目并将其添加到tfs,然后从git复制我的代码,但我丢失了我的历史(我不想要)。 What I am looking for here is a set of steps to accomplish what I need. 我在这里寻找的是一系列完成我需要的步骤。

In fact, git-tfs works only by cloning a TFS repository. 事实上,git-tfs只能通过克隆TFS存储库来工作。

I just hope that you've not a lot of branches to checkin into TFS otherwise it will be long an boring but doable! 我只是希望你没有很多分支机构来检查TFS,否则它将是一个无聊但可行的长期!

First, create an empty repository in tfs. 首先,在tfs中创建一个空存储库。

old solution (still valid if you want to take this way...): and clone it with tfs. 旧的解决方案 (如果你想采用这种方式仍然有效......): 并用tfs克隆它。 You should be able to do it that easily and should have only one commit with no files in this new git repository. 你应该能够轻松地完成它,并且在这个新的git存储库中应该只有一个没有文件的提交。

Now, add a remote toward your existing git repository and rebase the remote master onto the initial commit of the new repository. 现在,向现有的git存储库添加一个远程数据库,并将远程主服务器重新绑定到新存储库的初始提交。

new solution: Use this script 新解决方案:使用此脚本

Then use 'git tfs rcheckin' to commit all the history. 然后使用'git tfs rcheckin'提交所有历史记录。 It should be very long :( 它应该很长:(

After that, if you have branches that you want to commit, and if you have the last version of git-tfs 0.17.1, extract the good revision and create a tfs branch with the command : 之后,如果您有要提交的分支,并且如果您拥有最新版本的git-tfs 0.17.1,请提取正确的修订并使用以下命令创建tfs分支:

git tfs branch Name_of_my_branch git tfs分支Name_of_my_branch

and rebase all the commits of the git branch and use rcheckin with : git tfs rcheckin -i Name_of_my_branch 并重新命名git分支的所有提交并使用rcheckin:git tfs rcheckin -i Name_of_my_branch

Do that for all your branches and that should be good... 为你所有的分支做那件事应该是好的...

But I should add that if you've got merge commit, they will all be lost in the process :( You won't have a as beautiful repository than you're existing git repository 但是我应该补充一点,如果你有合并提交,它们将在这个过程中全部丢失:(你将没有一个比你现有的git存储库更漂亮的存储库

PS : PS:

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

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