使用 "theirs" 选项解决合并冲突(有利于合并分支)
Resolve merge conflicts using the "theirs" option (In favor of the merged branch)
所以我有两个分支,假设分支 A 和分支 B 我已将分支 A 合并到分支 B。
git checkout B
git merge A
现在我想解决分歧,支持命令行中的分支 A。我该怎么做?
您正在寻找 git merge
的 -s recursive -Xtheirs
选项。
此选项执行以下相反:
...This option forces conflicting hunks to be auto-resolved cleanly by favoring 'our' version. Changes from the other tree that do
not conflict with our side are reflected to the merge result. For a
binary file, the entire contents are taken from our side...
既然你已经开始了合并,你会想要中止它,因为你不能在当前合并期间应用这个合并策略。
git merge --abort
然后重新合并如下
git merge -s recursive -Xtheirs
这将进行合并,以便自动选择所有 'conflicts' 来自分支 A
所以我有两个分支,假设分支 A 和分支 B 我已将分支 A 合并到分支 B。
git checkout B
git merge A
现在我想解决分歧,支持命令行中的分支 A。我该怎么做?
您正在寻找 git merge
的 -s recursive -Xtheirs
选项。
此选项执行以下相反:
...This option forces conflicting hunks to be auto-resolved cleanly by favoring 'our' version. Changes from the other tree that do not conflict with our side are reflected to the merge result. For a binary file, the entire contents are taken from our side...
既然你已经开始了合并,你会想要中止它,因为你不能在当前合并期间应用这个合并策略。
git merge --abort
然后重新合并如下
git merge -s recursive -Xtheirs
这将进行合并,以便自动选择所有 'conflicts' 来自分支 A