git - 在初始 merge 冲突后强制 git rebase 接受我的版本

标签 git merge

这是一个 git rebase/merge/continue 场景,需要更方便的方法:

Given: a file that has changes in both the present branch and the branch being rebased onto.

Already performed: a manual merge of the files.

Complication: the following command seems to be required multiple times: it finds only a small portion of the "required" (according to git) changes to be merged at one shot:

    git rebase --continue

Desired outcome: have Git simply "accept" the file that I have in the existing branch.

What has been tried: after the initial rebase the original version of the file was copied on top of the merge conflicted version.

What happened: after git rebase --continue the file is still conflicted - but with a different set of merge conflicts. This process is repeated now a few times and not done yet.

我们可以直接接受我更新的文件吗?

最佳答案

您有多个冲突的原因是您要重新定位多个提交,其中几个(全部?)包含对文件的冲突更改。您不能跳过这些冲突解决步骤,因为您正在创建多个新提交,并且每个提交都需要一个特定版本的文件,处于已解决状态。

您可以像以前一样继续,也可以选择压缩您的提交,这样就无需生成多个提交而只 merge 一次。

关于git - 在初始 merge 冲突后强制 git rebase 接受我的版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40002089/

相关文章:

javascript - 合并 2 个嵌套对象/在 ES6 中有选择地覆盖

git - 项目 repo 中的 Vagrantfile,良好的 Vagrant 工作流程?

linux - Git 空格/行结尾

git - 删除不需要的 .keep 文件

git - 拒绝推送的文件

git - 如何搜索 git 存储库历史记录以查找 merge 错误?

git - 使用 Git Kraken 时如何移动存储库?

git - 在 git 中,如何增加 merge 的上下文?

git - 将远程存储库映射到包含文件的现有目录

git - 为什么 git 在 merge 时不识别先前 checkin 的重命名—— merge 方向重要吗?