且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Git拒绝在rebase上合并不相关的历史

更新时间:2023-02-09 21:55:00

自 Git 2.9 以来,默认行为发生了变化:

The default behavior has changed since Git 2.9:

"git merge" 用于允许合并两个没有共同点的分支默认情况下的基础,这导致了现有的全新历史项目创建,然后被一个毫无戒心的维护者拉取,这允许将不必要的并行历史合并到现有项目.该命令已被教导不允许这样做默认,带有逃生舱口 --allow-unrelated-history 选项用于合并两个项目历史的罕见事件独立开始了他们的生活.

"git merge" used to allow merging two branches that have no common base by default, which led to a brand new history of an existing project created and then get pulled by an unsuspecting maintainer, which allowed an unnecessary parallel history merged into the existing project. The command has been taught not to allow this by default, with an escape hatch --allow-unrelated-histories option to be used in a rare event that merges histories of two projects that started their lives independently.

请参阅 Git 版本更新日志 了解更多信息.

See the Git release changelog for more information.

您可以使用 --allow-unrelated-history 强制合并发生.

You can use --allow-unrelated-histories to force the merge to happen.