git-stitch-import:如何创建一个主分支? [英] git-stitch-import: how to make one master branch?

查看:115
本文介绍了git-stitch-import:如何创建一个主分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将几个git repos合并到一个新的repo中,每个旧repo作为新repo中的一个子目录。 git-stitch-repo似乎是我想要的工具。



然而,文档并不清晰。我能够关注它( https://metacpan.org/ pod / distribution / Git-FastExport / script / git-stitch-repo ),直到出现现在可以创建主分支并使其指向正确提交并删除两个主分区 A和master-B分支。



什么是正确提交,以及如何执行这些步骤?

现在我有几个分支标记为master-A,master-B等,这些分支似乎对应于原始回购。我真正想要的只是一个包含一切的主分支。这听起来有可能到达那里,但我不知道该怎么做。

://metacpan.org/author/BOOKrel =nofollow> author of 混帐十字绣回购。鉴于你的描述,它确实是你正在寻找的工具。



这是程序如何工作


  • git fast-export 的输出中获得的所有提交,以便合并并为 git fast-import 构建新流在新流中,可以从任何其他存储库提交一个提交作为父项

  • 程序确保如果您要过滤掉其他存储库中的所有提交,则会返回原始存储库



由于所有存储库都可以引用使用相同的名称,程序在引用名称末尾添加 -A -B 等等,因此您可以知道新存储库中的每个引用来自哪个存储库。这就是为什么你得到 master-A master-B 。选择正确的主人只是意味着决定哪一个 master -A master-B 是你的新的<$ c

当前版本的最大问题(我目前正在修复),是每个分支指向存储库A,系统必须决定从存储库B中附加下一个提交的哪一方(如果在尊重拼接算法的约束
如果所有选项都有效,则选择基本上是随机的。然后 master -A master-B 可以在不同分支上结束,这通常不是您想要的。 (这是 RT#70695 的全部内容。)



正如我上面所说,我正在努力解决问题,并且我有一个很好的希望它将解决您的问题。我希望能够在几天内发布新版本。


I am trying to merge several git repos into a new repo, with each old repo as a subdirectory in the new repo. git-stitch-repo appears to be the tool I want.

However, the documentation is less than clear. I was able to follow it (https://metacpan.org/pod/distribution/Git-FastExport/script/git-stitch-repo) until the part which says "It is now possible to create the master branch and have it point at the right commit, and delete the two master-A and master-B branches."

What is the "right commit", and how do I execute these steps?

Right now I have several branches labeled master-A, master-B, etc., which seem to correspond to the original repos. What I really wanted was just a master branch that contains everything. It sounds possible to get there, but I don't know how.

解决方案

I'm the author of git-stitch-repo. Given your description, it is indeed the tool you're looking for.

Here's how the program works:

  • it looks at all commits obtained from the output of git fast-export for each repository to merge and builds a new stream for git fast-import
  • in the new stream, a commit can be given a commit from any of the other repository as a parent
  • the program makes sure that if you would filter out all the commits from the other repositories, you'd get back the original repository

Because all repositories can have references with the same name, the program add -A, -B, etc. at the end of the references names, so you can know which repository each reference in the new repository comes from. This is why you get master-A and master-B. Picking the "right" master just means deciding which of master-A and master-B is your new master.

The biggest issue with the current version (I'm currently working on a fix), is that for every branch point in repository A, the system must decide on which side to attach the next commit from repository B (if there is actually an alternative between several valid commits that respect the constraints of the stitching algorithm. If all options are valid, the choice is basically random. And then master-A and master-B can end on different branches, which is usually not what you want. (This is what RT #70695 is all about.)

As I said above, I'm working on a fix, and I have a good hope that it's going to fix your issue. I expect to be able to do a new release withing a few days.

这篇关于git-stitch-import:如何创建一个主分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆