Git:没有冲突的开放合并工具

问题描述 投票:2回答:3

我有合并问题,但git不会将文件标记为冲突。当我尝试用git mergetool打开文件时,git只是说:No files need merging

如何在三方比较中打开没有合并冲突的文件?

git git-merge merge-conflict-resolution
3个回答
2
投票

您可以执行以下操作:

git merge --no-commit topic
git checkout --merge that_file
git mergetool that_file
git commit

也就是说,您避免成功合并创建提交,然后您假装that_file中存在冲突,然后您可以使用git mergetool处理该文件。最后,您提交结果。


0
投票

git mergetool使用.gitconfig [merge]部分中指定的工具 git mergetool - 工具帮助

结帐这个topic

将其中一个配置为git diff工具 例如:

git config --global diff.tool kdiff3

但据我所知,git diff只能做2路差异。 解决方案是签出3个不同的目录并运行kdiff3


0
投票

遗憾的是,我无法重现@Filp Stefanov的成功,所以我用手工做了很多

(来自存储库根目录)

git merge --no-ff --no-commit <topic>
git show HEAD:<file> > <file>.ours
git show MERGE_HEAD:<file> > <file>.theirs
$(git config merge.tool) <file>.ours <file> <file>.theirs
rm <file>.ours <file>.theirs
git add <file>
git commit

大声说,

  1. 将我们的文件版本显示到stdout并保存到某处
  2. 将他们的文件显示到stdout并保存到某个地方
  3. 打开我们当前的合并工具
  4. 做你的合并
  5. 删除.ours / .theirs文件
  6. 添加并提交合并文件

如果这基本上是git原生的话,我不会感到惊讶

© www.soinside.com 2019 - 2024. All rights reserved.