I have a version of a .tex
file from a number of commits ago that I would like to get a copy of. I have the sha1 hash value for the commit that has the version of that file that I want. I do not want to replace the current version of the file. Rather, I want to just get a separate copy of it that reflects its state at the older version.
A lot of similar questions suggest using git checkout <sha1> -- file.tex
, but this just keeps giving "error: pathspec 'file.tex' did not match any file(s) known to git."
The file I am interested in originally existed in the top-level directory of the repository. I am currently in a sub-directory of the repository trying to run this command so as to get the older version of file.tex in the subdirectory.
Is this possible? How can I do this?