简体   繁体   English

合并两个GitHub存储库时的问题跟踪器管理

[英]Issue tracker management when merging two GitHub repos

I have two GitHub repos I am merging into one repo (Project B merging into Project A). 我有两个GitHub存储库,我正在将其合并到一个存储库中(项目B合并到项目A中)。 I already understand how to merge the repos. 我已经了解了如何合并存储库。 Instead, my question is regarding the GitHub issue tracker. 相反,我的问题是关于GitHub问题跟踪器的。

On Project B, many commits referenced and closed many GitHub issues for that project. 在项目B上,许多提交引用了该项目,并关闭了许多GitHub问题。 When I merge the Project B code (complete will full history) into Project A, how do I prevent GitHub from automatically referencing and closing the Project A issues with the same numbers? 当我将Project B代码(完整的完整历史记录)合并到Project A中时,如何防止GitHub自动引用并关闭具有相同编号的Project A问题? For example, issue #3 on Project A is completely different that issue #3 on Project B, and should not be referenced by the commit messages pulled in from Project B. 例如,项目A上的问题3与项目B上的问题3完全不同,并且不应从项目B提取的提交消息中引用该问题。

I'd like to keep the full project history of Project B, but I'm afraid this issue may keep me from doing so. 我想保留Project B的完整项目历史记录,但是我担心这个问题可能会阻止我这样做。

Thanks for any guidance you can provide. 感谢您提供的任何指导。

I emailed GitHub support regarding this, and got this reply: 我通过电子邮件将其发送给GitHub支持,并得到了以下回复:

Turning off the referencing behavior is not possible currently. 当前无法关闭引用行为。 However, there is a workaround you might want to try. 但是,您可能要尝试一种解决方法。

Before you import commits from B into A, you could rewrite those commits. 在将提交从B导入到A之前,可以重写这些提交。 You would find all commit messages which contain the text "#NNN" and replace it with "user/repoB#NNN". 您将找到所有包含文本“ #NNN”的提交消息,并将其替换为“ user / repoB#NNN”。 In other words, #3 would be replaced with a more complete reference to the issue in question, so it wouldn't close issues in A (because the commit isn't referencing the issue in A, but in B). 换句话说,#3将替换为对所讨论问题的更完整引用,因此它不会关闭A中的问题(因为提交不是在A中而是在B中引用了该问题)。

The only problem with that approach is you would have to verify that the rewrite hasn't created a mess. 这种方法的唯一问题是,您将必须验证重写未造成混乱。 You would do that in a local copy, and take a backup of the original repository. 您将在本地副本中执行此操作,然后备份原始存储库。 You would then verify everything looks good after the rewrite before deciding to merge the repositories. 然后,在决定合并存储库之前,您将在重写后验证一切看起来都不错。

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

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