为什么git mergetool会在vimdiff中打开4个窗口? (我预计3) [英] Why does git mergetool opens 4 windows in vimdiff? (I'd expect 3)

查看:1412
本文介绍了为什么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

它们是什么?我想要一个3路diff:目标文件,合并文件和工作文件。如何配置我的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?


我不会骗你; fugitive.vim很可能是有史以来最好的
Git包装器。

I'm not going to lie to you; fugitive.vim may very well be the best Git wrapper of all time.

有一个很棒的vimcast, a href =http://vimcasts.org/episodes/fugitive-vim-resolving-merge-conflicts-with-vimdiff/ =noreferrer> Fugitive.vim - 解决与vimdiff的合并冲突,by德鲁尼尔。这是关于逃犯的系列文章的一部分。

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 更改为 mvim gvim

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)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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