如何在git中合并两个不同目录层次结构的分支? [英] How to merge two branches with different directory hierarchies in git?

查看:1826
本文介绍了如何在git中合并两个不同目录层次结构的分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始在Web应用程序项目中使用Maven,以便更改目录层次结构。我为Maven集成创建了一个新分支。现在我有两个分支,一个具有旧的目录层次结构,一个具有maven目录层次结构。两个分支都有新的提交(错误修正和新功能)。

I started using Maven with a web application project so the directory hierarchy changed. I created a new branch for the Maven integration. Now I have two branches one with the old directory hierarchy and one with the maven directory hierarchy. Both branches have new commits (bugfixes and new features).

我想摆脱旧的分支并将其更改合并到Maven分支中。 Git合并提供了无数的冲突,感觉不可能解决。我相信这是因为文件路径发生了变化。

I would like to get rid of the old branch and merge it's changes to the Maven branch. Git merge gives countless conflicts that feels like impossible to resolve. I believe that this is because file paths have changed.

这种合并的最佳方式是什么?

What is the best way to approach this merge?

推荐答案

尝试将 merge.renameLimit 设置为合并的最高值。 git会尝试检测重命名,但只有当文件数量低于此限制时,才需要O(n ^ 2)处理时间:

Try setting merge.renameLimit to something high for this merge. git tries to detect renames, but only if the number of files is below this limit, since it requires O(n^2) processing time:

git config merge.renameLimit 999999

然后完成后:

then when done:

git config --unset merge.renameLimit

这篇关于如何在git中合并两个不同目录层次结构的分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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