git 中的硬合并 [英] Hard Merging in git
问题描述
我想将分支A
与master
分支合并,以便在发生任何冲突时分支A
覆盖master
分支.
I want to merge a branchA
with the master
branch such that in case of any conflict branch A
overrides the master
branch.
基本上我想通过分支A
有什么想法吗?
推荐答案
你可以试试:
git checkout master
git merge -Xtheirs branchA
(如git merge -s ours代码>,
怎么样:他们的
"
这将避免 merge -ours
从 master
到 branchA
,然后从 branchA
合并到 master
在如何完全从另一个分支替换 git 中的 master 分支?")
(as described in "git merge -s ours
, what about "their
"":
This would avoid the merge -ours
from master
to branchA
, followed by the merge from branchA
to master
described in "How to replace master branch in git, entirely, from another branch?")
您在git 中还有各种其他选项使一个分支像另一个分支一样的命令"
如Git:合并到 master,同时自动选择使用分支覆盖 master 文件"中所述,重置会也可以用 branchA
完全替换 master
.
As mentioned in "Git: Merge to master while automatically choosing to overwrite master files with branch", a reset would also be possible to completely replace master
by branchA
.
这篇关于git 中的硬合并的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!