我想离开这个
A - B - C - D - E - F - G
其中Branch1指向E而Branch2指向G
到此:
Branch1: A - B - C - D - E
\
Branch2: F - G
我希望Branch2永远'赢',我已经达到了这个目标:
git rebase -s recursive -X theirs --onto C Branch1 Branch2
这很好 - 除了rebase在二进制文件上窒息 - 说它不能合并它们。我如何告诉git我不想合并它们,我只是想每次都采用'他们的'?
答案 0 :(得分:1)
我如何告诉git我不想合并它们,我只是想每次都采用'他们的'?
这将是一个自定义合并驱动程序,您可以专门与所有二进制文件关联(*.dll
,*.exe
,*.so
,...您的特定二进制扩展名在您的情况下)
有关插图,请参阅“git merge -s theirs
needed — but I know it doesn't exist”。
我未测试的是:自定义合并驱动程序是否适用于rebase --onto
。
答案 1 :(得分:0)
以下是黑暗中的镜头:
来自git-rebase
文档:
-m, --merge
Use merging strategies to rebase. When the recursive (default)
merge strategy is used, this allows rebase to be aware of renames
on the upstream side.
Note that a rebase merge works by replaying each commit from the
working branch on top of the <upstream> branch. Because of this,
when a merge conflict happens, the side reported as ours is the
so-far rebased series, starting with <upstream>, and theirs is the
working branch. In other words, the sides are swapped.
-X <strategy-option>, --strategy-option=<strategy-option>
Pass the <strategy-option> through to the merge strategy. This
implies --merge and, if no strategy has been specified, -s
recursive. Note the reversal of ours and theirs as noted in above
for the -m option.
如果-X
暗示--merge
,--merge
交换theirs
和ours
,则可能是问题所在。如果您为theirs
切换ours
会怎样?