首页 > 解决方案 > 如何使 git 冲突文件以所需的方式排序以解决

问题描述

如何使我的冲突文件以所需的顺序出现以解决冲突。
例如,如果我有 2 个名为 foo 和 bar 的分支,我想将 foo 合并到 bar 中,而 git 给我的冲突如下

CONFLICT (content): Merge conflict in x.py
CONFLICT (content): Merge conflict in z.py
CONFLICT (content): Merge conflict in y.py
Automatic merge failed; fix conflicts and then commit the result.

如果我使用命令,这里三个文件是冲突的,(x.py,y.py,z.py)

git mergetool --tool=meld

meld 工具将始终按字母顺序打开文件(此处为 x、y 然后 z),但我想解决 y、z、x 顺序中的冲突。

如果有人知道解决方案或解决方法,请告诉我。

谢谢

标签: gitmerge-conflict-resolutiongit-configmeldmergetool

解决方案


您始终可以手动传递文件名:

git mergetool --tool=meld y.py
git mergetool --tool=meld z.py
git mergetool --tool=meld x.py

推荐阅读