在重新编制代码的基础上如何解决您的冲突 [英] How to resolve your conflicts while rebasing your code
问题描述
我必须在git中将一个分支重新设置为另一分支.
I have to rebase one branch into other branch in git.
但是有700多个提交和200多个文件. 重新设定我的代码时,仅在早期提交时少数文件中发生了冲突.而且我只在少数几个文件中出现冲突.
But there are 700+ commits and 200+ files. While rebasing my code, The conflict occurred in few files at early commits only. And I getting the conflict in few files only.
有什么办法可以使我的代码基于基础,而我只能一次解决所有冲突,而不必在每次提交后都解决.
So is there way so I can rebase my code while I have to resolve all conflicts at once only instead of resolving after each commit.
推荐答案
我的建议是查看git rerere
: https://git-scm.com/docs/git-rerere
我自己从未使用过它,因此无法提供任何示例,但是上面链接中的描述指出:
I've never used it myself, so can't offer any examples, but the description at the link above states:
此命令通过在初始手动合并中记录冲突的自动合并结果和相应的手动解决结果,并将先前记录的手动分辨率应用于其相应的自动合并结果,来帮助开发人员[一遍又一遍解决相同的冲突].
This command assists the developer [resolve the same conflicts over and over again] by recording conflicted automerge results and corresponding hand resolve results on the initial manual merge, and applying previously recorded hand resolutions to their corresponding automerge results.
这基本上使您可以重新使用重新编码的重新解决方案(因此rerere
)
This basically allows you to Reuse Recorded Resolution (hence rerere
)
在遇到第一个自动合并冲突时,您只需运行git rerere
,然后在解决它后再次运行它.然后,每次发现相同的冲突时,Git都会将相同的分辨率应用于您的仓库.
You simply run git rerere
when the first auto-merge conflict is hit, then run it again once you've resolved it. Git will then apply the same resolution to your repo every time it spots the same conflict.
这篇关于在重新编制代码的基础上如何解决您的冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!