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.
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?
> and put it into a file that you can open in emacs.
git show commit-id:filename > oldfile
Then open the file in emacs.
If you are using
bash, you can use Process Substitution.
gvim <(git show commit-id:filename)
Emacs package git-timemachine lets you step back and forth through git revisions of a file:
Using the following Vim command, one can view a previous version of a file without having to cleanup anything afterward.
git show commit-id:filename | vim - -n
Explanation: The dash argument of the vim command makes vim load whatever comes in from standard input. The -n option suppresses the creation of swap files.