Git rebase报错‘fatal: cannot combine apply options with merge options’原因咨询
Git报错"fatal: cannot combine apply options with merge options"原因及解决
报错原因
你执行的git rebase命令里同时包含了两类冲突的参数:
-X theirs是合并策略扩展选项,用于合并冲突时自动优先采用对方分支的内容,仅在rebase以「合并模式」运行时生效。--onto参数会让Git默认切换到「apply模式」(将提交当作补丁逐个应用到目标分支),这种模式下不支持任何合并相关选项,因此Git抛出冲突提示。
解决方法
根据你的需求,有两种可行修正方式:
手动处理冲突:移除
-X theirs选项,执行命令:git rebase --onto new-repo --committer-date-is-author-date commit_id master遇到冲突时,执行
git checkout --theirs <冲突文件名>取目标分支内容解决冲突,之后用git rebase --continue继续。强制启用合并模式:添加
--merge参数,让rebase以合并模式运行,这样就能兼容-X theirs选项,命令修改为:git rebase --merge -X theirs --onto new-repo --committer-date-is-author-date commit_id master
内容的提问来源于stack exchange,提问作者MobxLimited
相关产品推荐
相关产品推荐

