2012-12-25 114 views
11

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

我该怎么做?

+0

请参阅:HTTP:// stackoverflow.com/questions/173919/git-merge-s-ours-what-about-他们的 –

+1

我读过,但我没有找到解决我的问题。你能说明你的意图吗?请注意,Git说我应该修复冲突,然后运行'git commit'。我只能在你链接的问题中找到'git merge'命令。 – danijar

+0

你能向我解释更多,你做了什么,在哪个分支以及你想做什么? –

回答

12

这是一个坏主意提交的二进制文件,但我会向你解释如何使你需要什么

你在分支特殊和你做一个合并,你有固定的一些冲突,你想让别人像分支主,所以你应该让这个

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} 

您使用主如果改变是在你的本地仓库,如果变化是在遥远的库中,您使用origin/master

+0

谢谢,我现在所做的是1.添加所有重要文件,2.用'--mixed'重新设置,3.再次添加重要文件,4.提交。 – danijar

+0

这根本行不通*。 “git reset --mixed”*不会*“不存档所有冲突的文件”。也许它曾经,也许这是一个错误?无论如何:不要这样做。 – Adam