如何使用“ git mergetool”解决多个冲突?无需关闭文件之间的编辑器? [英] How resolve multiple conflicts with "git mergetool" without having to close the editor between files?

查看:219
本文介绍了如何使用“ git mergetool”解决多个冲突?无需关闭文件之间的编辑器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现 git mergetool 是用于可视化合并差异的便捷实用程序,但是我的操作方法似乎很奇怪。本质上,当报告冲突时,我的过程如下所示:

I've found git mergetool to be a handy utility for merging diffs visually, but the way I'm going about it seems really wonky. Essentially, my process looks like this when conflicts are reported:


  1. 执行 git mergetool

  2. 在提示符下,按 Enter 启动我的差异工具(Meld或FileMerge,具体取决于哪台计算机)

  3. 解决冲突

  4. 保存更改

  5. 关闭差异工具

  1. Execute a git mergetool
  2. At the prompt, hit Enter to launch my diff tool (Meld or FileMerge, depending on which computer)
  3. Resolve the conflicts
  4. Save the changes
  5. Close the diff tool

如果我有多个冲突,请冲洗,然后重复。是的,那是我为合并中的每个冲突打开和关闭差异查看器一次。由于它是从命令行启动的,因此关闭它是我知道的唯一告诉git mergetool我已经解决了这一特殊冲突并且可以继续处理下一个冲突的方法。

If I have more than one conflict, rinse, repeat. Yep, that's me opening and closing my diff viewer once for each conflict in the merge. Since it's launched from the command line, closing it is the only way I know of to tell git mergetool that I've resolved this particular conflict and that it can move on to the next.

当然有更好的方法,但是我不知道。可以帮忙吗?

Surely there's a better way, but I have no idea. Li'l help, please? This process seems crazy inefficient.

推荐答案

乍一看,似乎无法重用外部差异工具会话。

At first glance, it does not seem possible to reuse an external diff tool session.

git-mergetool 文档明确指出:

The git-mergetool documentation clearly states:


如果自定义合并工具正确地指示了合并决议 及其退出代码 的成功,然后是配置变量 mergetool。< tool> .trustExitCode 可以设置为true。

否则, git-mergetool 将在自定义工具后提示用户指示解析成功已经退出。

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.

因此退出代码(或差异工具退出后用户的验证 ),这意味着用户首先关闭了外部差异工具。

So the exit code (or the validation of the user after the exit of the diff tool) is needed, implying that the user first close the external diff tool.

减少每次合并/变基一次尝试的冲突次数;)(无论使用哪种VCScs工具)

That seems a great incentive to reduce the number of conflicts on each merge/rebase one attempts ;) (whatever the VCScs tool used)

注意:

另外两个git external diff工具设置( 在Windows上为Git设置差异和合并工具 使用Git设置SourceGear DiffMerge )在不关闭时不会给更多希望外部差异工具...

Note:
Two other git external diff tools settings ("Setting up diff and merge tools for Git on Windows" and "Setting up SourceGear DiffMerge with Git") do not give more hopes when it come to not closing the external diff tool...

这篇关于如何使用“ git mergetool”解决多个冲突?无需关闭文件之间的编辑器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆