强制使用vimdiff显示diff以显示diff [英] Force git show to show diff using vimdiff

查看:246
本文介绍了强制使用vimdiff显示diff以显示diff的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我该怎么做?通过 git config 进行更改后,我可以通过vimdiff区分我的分阶段和提交更改,但是当我执行 git show 时,我仍然请参阅旧平面样式中的差异。我该如何为 git show 做这项工作? 默认 git show 不带参数以及 git show< object> 显示提交中所有文件的更改。由于vimdiff一次只能比较一个文件,因此不能在这些选项中使用它。



然而 git show< object> - < file> 显示提交中单个文件的更改。您可以运行 difftool 来显示vimdiff中的更改: difftool SHA〜:SHA - < file>

如果您需要更大的灵活性,您可以始终使用 git show 获取文件的特定版本并通过进程替代版本将它们传递到vimdiff中

  export FILE = path / to / file; vimdiff<(git show SHA1:$ FILE)<(git show SHA2:$ FILE)


How do I do this? After doing changes via git config I can diff my staged and committed changes with vimdiff but when I do git show I still see the diff in old plain style. How do I make this work for git show as well?

解决方案

The default git show with no parameter as well as git show <object> display changes to all files within a commit. Since vimdiff can only compare a single file at a time, you cannot use it with these options.

However git show <object> -- <file> shows the changes to a single file within a commit. You can display the changes in vimdiff by running difftool instead:

git difftool SHA~:SHA -- <file>

If you need more flexibility, you can always use git show to fetch specific versions of a file and pass them into vimdiff via Process Substituion

export FILE=path/to/file; vimdiff <(git show SHA1:$FILE) <(git show SHA2:$FILE)

这篇关于强制使用vimdiff显示diff以显示diff的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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