最近我一直在看 https://martinfowler.com/articles/branching-patterns.html#long-lived-release-branch 这篇文章
看到 Variation: Long Lived Release Branch 这个部分的时候

If merged in we must be careful that the head of the release branch exactly matches the head of mainline. One way to do this is to revert all the of fixes that have been applied to mainline before merging.
看到这部分的时候突然有些疑问,它的意思是向 release 分支上合并的时候,先要把应用到 mainline 上的那些 fixes revert 掉。
比如 M7 那里向 release 合并到时候,要先把 F1 和 F2 revert 掉(一开始我理解的是把 mainline 上的那两个小黄点 revert 掉,后来感觉不对,应该是 release 上的 F1 和 F2,因为 mainline 上的 revert 了后修复就没了,bug 就继续在 mainline 上存在了)。
但我感觉这么做是没必要的,为什么要 revert ?直接合并不也一样的吗?后来我就发了一个邮件问了一下 Martin,他回我说“The problem occurs if F1 or F2 don't merge cleanly into mainline. In that case the M4-7 likely won't merge cleanly on top of v.2.2. But if you reset the release branch to the prior release, then you can replay the mainline commits without running into that kind of problem.”
他说因为 F1 和 F2 向 mainline 合并的时候可能不会 merge cleanly (我暂且理解为有冲突的合并),所以 M4-7 合回来的时候也有可能不会 merge cleanly 。
但是我又自己测试了一下,在向 mainline 合并的修复有冲突的情况下,冲突进行解决和完成合并,最后再往 release 合并的时候直接快进合并了,并没有遇到不能 merge cleanly 的情况。
所以我的疑问是,大家看看我上面的理解对不对,这个 revert 是不是真的有必要?是否真的如同大佬所说,不进行 revert,向 release 合并的时候可能出现不能 merge cleanly 的情况?


