我发现 git mergetool 是一个方便的实用工具,可以直观地 merge 差异,但我的处理方式似乎很奇怪。本质上,当报告冲突时,我的流程如下所示:
- 执行 git mergetool
- 在出现提示时,按 Enter 启动我的 diff 工具(Meld 或 FileMerge,具体取决于计算机)
- 解决冲突
- 保存更改
- 关闭比较工具
如果我有不止一个冲突,冲洗,重复。是的,这就是我为 merge 中的每个冲突打开和关闭差异查看器一次。因为它是从命令行启动的,所以关闭它是我知道的告诉 git mergetool 我已经解决了这个特定冲突并且它可以继续下一个冲突的唯一方法。
肯定有更好的方法,但我不知道。请李帮忙好吗?这个过程看起来非常低效。
最佳答案
乍一看,重用外部差异工具 session 似乎是不可能的。
git-mergetool
documentation明确指出:
If the custom merge tool correctly indicates the success of a merge resolution with its exit code, then the configuration variable
mergetool.<tool>.trustExitCode
can be set to true.
Otherwise,git-mergetool
will prompt the user to indicate the success of the resolution after the custom tool has exited.
因此需要退出代码(或用户在差异工具退出后的验证),暗示用户首先关闭外部差异工具。
这似乎是减少每次 merge/ rebase 一次尝试中的冲突数量的一个很好的动机;)(无论使用什么 VCScs 工具)
注意:
其他两个 git 外部差异工具设置(“Setting up diff and merge tools for Git on Windows”和“Setting up SourceGear DiffMerge with Git”)在不关闭外部差异工具时没有给予更多希望...
关于git - 如何在不关闭文件之间的编辑器的情况下解决与 "git mergetool"的多个冲突?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/585844/