解决git rebase冲突的方式与之前解决的方式相同 [英] Resolve git rebase conflicts the same way they were resolved previously

查看:710
本文介绍了解决git rebase冲突的方式与之前解决的方式相同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我决定从其他旧版本控制系统回顾历史,这从来没有在Git中。所以我创建了一个孤儿分支newroot,并从其他版本控制系统向它导入了提交。以下问题在Git的根提交之前插入提交?



newroot分支结尾的文件完全匹配master分支的根提交。



现在我想将master分支重定位到 newroot孤立分支,如:

  git rebase --onto newroot --root master 

问题是我得到提示以解决所有合并冲突。多年来有数百次合并。我只是不能手动解决它们。而且真的没有必要,因为这些合并在过去已经得到解决。由于rebase实际上不会改变内容(因为我在同一棵树上重新绑定),所以我希望Git准确地重放合并。



有一种方法可以指定底框应该使用与以前使用的分辨率相同的分辨率吗?



我明白rerere可能对此有所帮助。但是当我最初合并时,我必须启用它,对吗?或者我可以回顾性地重新创建rerere缓存?






我可以想象我的任务的替代解决方案。以某种方式要求Git连接newroot和master分支,而不实际重新分配。但我不确定这是否可能。

解决方案


以某种方式要求Git连接新根和主分支,而没有实际重新分配。但我不确定这是否可能。 嫁接点,后面跟着一个 filter-branch 为了重写主记录。

请参阅 b

在rebase方面,您可以尝试使用像他们这样的合并策略来解决使用master分支内容(因为master正在重新发布)

  git rebase --merge -s递归-X他们的 -   -  newroot  - -root master 


I've decided to retrospectively commit a history, that was never in Git, from an other old version control system. So I've created an orphan branch "newroot", and imported commits from the other version control system to it. Following question Insert a commit before the root commit in Git?

The "newroot" branch ended up with files exactly matching the root commit of the "master" branch.

Now I want to rebase the "master" branch onto the "newroot" orphan branch, like:

git rebase --onto newroot --root master

The problem is that I get prompted to resolve all merge conflicts. There are hundreds of merges over a span of many years. I'm just not capable of resolving them manually. And there's really no need, as these merges were already resolved in the past. As the rebase actually does not change contents (as I'm rebasing on an identical tree), I want Git to "replay the merge" exactly.

Is there a way to specify that the rebase should use the same resolution as was used previously?

I understood that the "rerere" may help here. But I would had to have it enabled already, when originally merging, right? Or can I retrospectively recreate the "rerere" cache?


I can imagine an alternative solution to my task. To somehow ask Git to concatenate the "newroot" and "master" branches, without actually rebasing. But I'm not sure if that's possible.

解决方案

To somehow ask Git to concatenate the "newroot" and "master" branches, without actually rebasing. But I'm not sure if that's possible.

That is called a graft point, followed by a filter-branch in order to rewrite master history.
See this post as an example or this question.

On the rebase side, you can try and use a merge strategy like theirs, to resolve any conflict using the master branch content (since master is being rebased)

git rebase --merge -s recursive -X theirs --onto newroot --root master

这篇关于解决git rebase冲突的方式与之前解决的方式相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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