In git we can easily construct revisions pointing to previous commits like HEAD~
HEAD^
and show files on those revisions like
git show HEAD~:myfile
What is the syntax to show the previous version of myfile
without first consulting git log
to get the commit hash?
I also use fugitive
in vim
and sometimes needs to open a file's previous version using :Gedit
. But I don't know what to supply as argument.
Note: This solution requires you to specify the path twice, and can be quite verbose to type every time. An alias would perhaps be better.
To get the previous hash: