Why does git mergetool open 4 windows in vimdiff? (I'd expect 3)

前端 未结 5 1608
北荒
北荒 2021-01-30 14:28

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

>git mergetool -t vimdiff

It opened vimdiff

5条回答
  •  自闭症患者
    2021-01-30 14:46

    As an alternative, have you thought about using fugitive?

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

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

    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
    

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

    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.

提交回复
热议问题