Viewing all `git diffs` with vimdiff

China☆狼群 提交于 2019-12-17 10:07:06

问题


I setup git diff to wrap into vimdiff, using "Git Diff with Vimdiff" as a guide, and it's working as expected unless there are many files with changes.

When there are multiple files with changes and I run git diff, it opens the first file and, after quitting the first instance of vimdiff, I'm presented with the following message:

external diff died, stopping at filename

This is a completely different behavior than I am used to. I had a similar setup in the past with SVN and, when diffing against multiple files, I would review the first file, then write and quit using :wq and the next file with differences would open up.

This is not the case with Git. I tried :n[ext], but doing so does not fill the left window with the original file so that it can be diffed against the modified version.


回答1:


git config --global diff.tool vimdiff
git config --global difftool.prompt false
git config --global alias.d difftool

Typing git d yields the expected behavior, typing :wq in vim cycles to the next file in the changeset.




回答2:


You can try git difftool, it is designed to do this stuff.

First, you need to config diff tool to vimdiff

git config diff.tool vimdiff

Then, when you want to diff, just use git difftool instead of git diff. It will work as you expect.




回答3:


Git accepts kdiff3, tkdiff, meld, xxdiff, emerge, vimdiff, gvimdiff, ecmerge,
and opendiff as valid diff tools. You can also set up a custom tool. 

git config --global diff.tool vimdiff
git config --global diff.tool kdiff3
git config --global diff.tool meld
git config --global diff.tool xxdiff
git config --global diff.tool emerge
git config --global diff.tool gvimdiff
git config --global diff.tool ecmerge


来源:https://stackoverflow.com/questions/3713765/viewing-all-git-diffs-with-vimdiff

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!