如何强制git merge在所有文件或所有文件上产生冲突,以产生具有完整旧版本和全新版本的冲突,例如:
<<<<<<<<<<A
A
B
C
D
OLD
OLD
OLD
E
F
G
...
Z
============
A
B
C
D
NEW
NEW
NEW
EEEEEEE
FFFFF
GGG
...
Z
>>>>>>>>>>B
我的想法是,我想手动合并两个文件的全部内容,如果行相同或者一个分支从整个前一个继承,则不会出现问题,例如:
$ echo ABC > file
$ git add file
$ git commit -m '+) file = ABC'
[master 6e91bce] +) file += ABC
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 file
$ git checkout -b new_branch
Switched to a new branch 'new_branch'
$ echo DEF >> file
$ git add file
$ git commit -m '+) file += DEF'
[new_branch 27e29bf] +) file += DEF
1 files changed, 1 insertions(+), 0 deletions(-)
$ git checkout master
Switched to branch 'master'
$ git merge --no-ff new_branch
Automatic merge went well
$ cat file
ABC
DEF
我理解git
自动将“DEF”添加到“文件”的原因。但我想强迫git“思考”:
我已经阅读了有关制作“合并驱动程序”的其他帖子,但我很清楚如何使用它来制作git。 (脚本很明显,只有几行)。
P.S。感兴趣的人:我不使用任何合并工具。我想将TSV spreadsheets与DataSet和ResultsSets合并。在它们不同的所有情况下(即使它只在一个分支上编辑),我想用我自己的工具链手动处理它们来处理这些DataSet。
答案 0 :(得分:2)
你仍然需要告诉Git这些应该被视为二进制文件,如果存在任何差异,将导致冲突。您现在可以自行调查文件,例如git show otherbranch:thefile
和git show HEAD:thefile
。编辑文件后,将其添加到git commit
。