Git merge - manual merge - forcing conflicting with WHOLE old and new version of file

How to force git to merge to create a conflict in all files or all files that differ to generate a conflict having all old and whole new version, example of such file:

<<<<<<<<<<A
A
B
C
D
OLD
OLD
OLD
E
F
G
...
Z
============
A
B
C
D
NEW
NEW
NEW
EEEEEEE
FFFFF
GGG
...
Z

>>>>>>>>>>B

      

The idea is that I would like to merge manually, having all the contents of the two files, no metric, if the lines are identical or one branch inherits from everything previous, for example:

$ 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

      

I understand the reason it git

automatically adds "DEF" to "file". But I would like to make git "think":

  • file master / file and new_branch / file is different
  • I will make a conflict with the whole OLD and all new version to allow my users to manually resolve it.

I've read other posts about creating a "driver merge" but it's not clear to me how to make git use it. (Script is obviously just a few lines).

PS For interested people: I am not using the merge tool. I would like to concatenate TSV tables using DataSets and ResultsSets. In all cases where they are different (even if they are edited in only one branch), I would like to handle them manually with my own toolchain to process these datasets.

0


source to share


1 answer


You still need to tell Git to treat them like binaries, which will lead to a conflict if there is any difference. Now you need to examine the files yourself using git show otherbranch:thefile

and git show HEAD:thefile

. After editing the file, you add it and git commit

.



+2


source







All Articles