本文介绍了撤销在rebase中完成的git rerere解析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,我真的很喜欢git rerere命令。虽然,除了让它自动地记录我的冲突并为我解决它之外,我还没有真正使用它。然而,在一次大规模的重新布局期间,我确实搞乱了我的一个冲突解决方案(用最新版本重新组装了一个非常陈旧的功能分支)。 $ c>功能 - > a - b - c - d

发布 - > e - f - g - h

rebase / feature - > e - f - g - h - a' - b' - c' - d'

比如说b'有一个不正确的合并(感谢我!),我想重新记录它。我会怎么做?我见过中提到的git checkout --conflict选项,但我对于如何工作以及它是否适用于此,我不太清楚。也许我必须检查合并冲突状态,并运行git rerere,一旦我正确地解决了这个冲突?



通常情况下,我只是承诺rebase分支的一角,但这是一个扔掉。我只是想提前处理冲突,所以当我与该功能团队同步时,我们会尽量缩短所需时间。有道理吗?

解决方案

您可以告诉 rerere 通过重新执行合并并允许 rerere 将其记录的分辨率应用到工作树中。



你可以看看 a',然后做一个 git merge b 来重新回到这种情况因为您指定了 a'的提交哈希值,所以请注意您并不在某个分支上)。



然后使用 git rerere忘记FILE-WITH-BAD-MERGE 在哪里指定记录的冲突解决应该被忘记的文件。

(From )。


Okay, so I really like the git rerere command. Although, I haven't really used it that much other than letting it auto-magically record my conflicts and resolve them for me. However, I did mess up one of my conflict resolutions during quite a large rebase (rebasing a really stale feature branch with the latest release).

feature -> a - b - c - d

release -> e - f - g - h

rebase/feature -> e - f - g - h - a' - b' - c' - d'

So, say for instance that b' has an incorrect merge (thanks to me!), and I want to re-record that. How would I do it? I've seen the git checkout --conflict option, mentioned in Rerere Your Boat, but I'm not too clear on how that works and if it applies here. Maybe I have to checkout the merge conflict state and run git rerere once I correctly resolve this conflict?

Normally, I would just commit to the tip of the rebase branch, but it is a throw away. I'm just trying to handle conflicts ahead of time, so that when I sync up with that feature team, we minimize the time it takes. Make sense?

解决方案

You can tell rerere to forget the recorded resolution for a merge by re-executing the merge and allowing rerere to apply its recorded resolution in the work tree.

You can check out a' and then do a git merge b to get back into that situation (you'll probably be in a checkout of a detached head since you specified the commit hash of a', so be aware that you're not on a branch).

Then use git rerere forget FILE-WITH-BAD-MERGE where to specify the file whose recorded conflict resolution should be forgetten.

(From the Git documentation for git-rerere.)

这篇关于撤销在rebase中完成的git rerere解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-10 05:20