git在编辑器中显示文件的旧版本 [英] git show old version of file in editor
问题描述
我发现我可以使用'git log filename'显示文件的旧版本来显示提交,然后使用'git show commit-id:filename'来显示旧版本.但这只是减少了投入.
I figured out I can show old versions of a file using 'git log filename' to show the commits, and then use 'git show commit-id:filename' for the old version. But it just puts it in less.
我希望能够在emacs中查看此内容,因此我可以按照自己的习惯进行导航,从而突出显示语法.我发现我无法将git core.pager设置为emacs,因为emacs无法从标准输入中读取.
I would like to be able to view this in emacs, so I can navigate as I'm used to and so that there is syntax highlighting. I found out I can't set the git core.pager to emacs since emacs cannot read from stdin.
有人知道我该怎么做吗?还是您有另一种检查文件旧版本的好方法?
Does anyone know how I could do this? Or do you have another good way of checking old versions of files?
推荐答案
只需使用>
并将其放入可以在emacs中打开的文件中即可.
Just use >
and put it into a file that you can open in emacs.
git show commit-id:filename > oldfile
然后在emacs中打开文件.
Then open the file in emacs.
这篇关于git在编辑器中显示文件的旧版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!