本文介绍了为什么git mergetool在vimdiff中打开4个窗口? (我希望3)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

遇到冲突时,我尝试使用git-mergetool来解决它.我输入:

When I met a conflict, I tried to use git-mergetool to solve it. I typed:

>git mergetool -t vimdiff

它以4向而不是3向打开vimdiff.我在vimdiff中分割的窗口看起来像:

It opened vimdiff in 4-way, not 3-way. My split windows in vimdiff look like:

:ls
  1 #a   "Gemfile.lock"                 line 1
  2 %a   "Gemfile.lock.LOCAL.4828.lock" line 1
  3  a   "Gemfile.lock.BASE.4828.lock"  line 0
  4  a   "Gemfile.lock.REMOTE.4828.lock" line 0

它们是什么?我想要一个三向差异:目标文件,合并文件和工作文件.我应该如何配置git或vimdiff?

What are they? I want a 3-way diff: target file, merge file and working file. How should I configure my git or vimdiff?

推荐答案

作为替代方案,您是否考虑过使用逃犯?

As an alternative, have you thought about using fugitive?

有一个很好的vimcast, Fugitive.vim- Drew Neil解决了与vimdiff 的合并冲突.这是关于逃犯的系列文章的一部分.

There is a an excellent vimcast, Fugitive.vim - resolving merge conflicts with vimdiff, by Drew Neil. This is part of a series on fugitive.

Vimcasts 网站是了解有关vim的好地方.

The Vimcasts website is a good place to learn more about vim.

要在合并工具中使用逃犯,可以使用以下命令.

To use fugitive as you mergetool you can use the following.

git config --global mergetool.fugitive.cmd 'vim -f -c "Gdiff" "$MERGED"'
git config --global merge.tool fugitive

注意:您可能需要将vim更改为mvimgvim.

Note: you may want to change vim to mvim or gvim.

逃避者提供的功能不仅仅是合并工具脚本,因此请确保您阅读了文档和/或查看了Vimcast.

Fugitive has a lot more to offer than just being a merge tool script so make sure you read the documentation and/or check out the vimcasts.

这篇关于为什么git mergetool在vimdiff中打开4个窗口? (我希望3)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 05:28