15

在我解决了我关心的所有合并冲突之后,我想合并而不考虑所有剩余的冲突。我希望 git 保留要合并到的分支中的文件(--ours策略)。

我怎样才能做到这一点?

4

1 回答 1

19

提交二进制文件是个坏主意,但我会向你解释如何制作你需要的东西

你在特别分支中并且你已经完成了合并,你已经修复了一些冲突并且你想让其他人喜欢分支主所以你应该这样做

git reset --mixed (reset the index but not the working tree; changes remain localy but not used in the commit)
git add {files those you have fixed the conflict}
git commit
git reset --hard
git merge --strategy=recursive -X theirs origin/master  
{merge twice and you take files as in branch origin/master}

如果更改在本地存储库中,则使用 master,如果更改在远程存储库中,则使用origin/master

于 2012-12-26T09:47:44.520 回答