git - 如何在不关闭文件之间的编辑器的情况下解决与 "git mergetool"的多个冲突?

标签 git diff mergetool

我发现 git mergetool 是一个方便的实用工具,可以直观地 merge 差异,但我的处理方式似乎很奇怪。本质上,当报告冲突时,我的流程如下所示:

  1. 执行 git mergetool
  2. 在出现提示时,按 Enter 启动我的 diff 工具(Meld 或 FileMerge,具体取决于计算机)
  3. 解决冲突
  4. 保存更改
  5. 关闭比较工具

如果我有不止一个冲突,冲洗,重复。是的,这就是我为 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/

相关文章:

node.js - 如何将文件夹添加到 .gitignore

git - 如何以编程方式将文件上传到 github 存储库的下载区域?

git - 'git format-patch and ' git diff' 有什么区别?

visual-studio - 如何在 Visual Studio 中使用 Rational Team Concert 配置 Visual Studio 代码合并工具?

git vimdiff mergetool 基本命令?

Git master 分支作为 live 版本的理解

javascript - nodejs lstat 找不到文件

git - 在 git 中,如何增加 merge 的上下文?

hadoop - 如何在Hadoop中实现差异?

gitcherry-pick : how consider only lines modified by the commit (i. e.,不是周围的上下文)?