简体   繁体   English

撤消在 rebase 中完成的 git rerere 解决方案

[英]Undo a git rerere resolution that was done in a rebase

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.好的,所以我真的很喜欢git rerere命令,尽管除了让它自动神奇地记录我的冲突并为我解决它们之外,我并没有真正使用过它。 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).但是,在相当大的 rebase 期间,我确实弄乱了我的一个冲突解决方案(用最新版本 rebase 一个非常陈旧的功能分支)。

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,).因此,例如说b'有一个不正确的合并(感谢我,)。 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.我已经看到Rerere Your Boat中提到的git checkout --conflict选项,但我不太清楚它是如何工作的以及它是否适用于此处。 Maybe I have to checkout the merge conflict state and run git rerere once I correctly resolve this conflict?也许我必须检查合并冲突 state 并在正确解决此冲突后运行git rerere

Normally, I would just commit to the tip of the rebase branch, but it is a throw away.通常,我只会提交到 rebase 分支的尖端,但它是一次性的。 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?有道理?

To simply remove all previous rerere resolutions, run rm -rf .git/rr-cache to remove the cache. 要简单地删除所有先前的rerere分辨率,请运行rm -rf .git/rr-cache以删除缓存。

For a specific merge, you can tell rerere to forget the recorded resolution by re-executing the merge and allowing rerere to apply its recorded resolution in the work tree. 对于特定的合并,您可以通过重新执行合并并允许rerere在工作树中应用其记录的分辨率来告知rerere忘记记录的分辨率。

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). 您可以查看a'然后执行git merge b以重新进入这种情况(因为您指定a'的提交哈希值,所以您可能会在一个分离头的结帐中,所以请注意,您不是在一个分支上)。

Then use git rerere forget FILE-WITH-BAD-MERGE where to specify the file whose recorded conflict resolution should be forgetten. 然后使用git rerere forget FILE-WITH-BAD-MERGE在哪里指定应该忘记记录的冲突解决方案的文件。

forget <pathspec>
Reset the conflict resolutions which rerere has recorded for the current conflict in . 重置rerere为当前冲突记录的冲突解决方案。

(From the Git documentation for git-rerere .) (来自git-rerere的Git文档 。)

Git cherry-pick supports --no-rerere-autoupdate option, that is what I use. Git cherry-pick 支持--no-rerere-autoupdate选项,这就是我使用的。

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

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