与“git mergetool”合并 [英] Merging with "git mergetool"

查看:101
本文介绍了与“git mergetool”合并的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现 git mergetool 是一个方便的实用工具,可以直观地合并差异,但我对它的看法确实很无趣。从本质上讲,我的过程在报告冲突时看起来像这样:


  1. 执行 git mergetool

  2. 在提示符下,点击 Enter 启动我的diff工具(Meld或FileMerge,具体取决于哪台计算机)
  3. 解决冲突 li>
  4. 保存更改

  5. 关闭diff工具

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



当然有更好的方法,但我不知道。请帮忙吗?这个过程看起来非常疯狂。 解析方案

乍一看,似乎不可能重用外部diff工具会话。 p>

git-mergetool 文档明确指出:


合并工具正确地指示合并解析 成功使用其退出代码 ,然后配置变量 mergetool。< tool> .trustExitCode 可以设置为true。

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

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



这似乎是一个很好的例子以减少每次合并/重新分配一次尝试的冲突次数;)(无论使用哪种VCScs工具)注意:

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


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. 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

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.

The git-mergetool documentation clearly states:

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.

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

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天全站免登陆