Forcing 'git merge' to declare all differences as a merge conflict

前端 未结 3 888
一生所求
一生所求 2021-02-09 19:20

In a \'git merge \' I would like any difference, even if not normally a merge conflict, to be considered a merge conflict. Then, with \'git mergetool\' I can see and resolve ea

3条回答
  •  佛祖请我去吃肉
    2021-02-09 19:30

    I have a similar desire and have been unable to do it with the automatic tools. Here is a semi automated solution:

    From master, merge add-on and manually resolve changes:

    Start with:

    git merge --no-ff --no-commit add-on
    

    Then, for each changed file do:

    git show master:path/to/file > from_master
    git show add-on/to/file > from_add-on
    kdiff3 --qall from_master from_add-on -o path/to/file
    git add path/to/file
    

    Finally,

    git commit
    

    Why this 90% solution?

    This solution merges even in "obvious situations" and it doesn't force me to set .gitattributes so I can make "manual merge" behavior dependent on who I am merging from and why rather than on which files I am merging.

提交回复
热议问题